vendredi 26 octobre 2018

Java Design Pattern for different variation of same input to be converted into common output

I have a scenario where there is a service aggregator, lets take for example skyscanner or kayak or Google flights. If you see, they all ask basic details like what is source, destination, date and number of passengers, once you select the flight from a particular service provider, let's say for example expedia, you are are redirected to expedia with prefilled details that was sent across by service aggregator

Now the name of parameters sent from the source system may vary and on the destination we have to convert it into same POJO.

One option I was thinking of was Factory pattern, based on channel, I would return an object which would transform the source params to a common POJO.

Other design pattern that I feel similar is Strategy Design Pattern, to create a ExtractionStrategy based on Context

Is there any other apt design patter to solve this problem?

Aucun commentaire:

Enregistrer un commentaire