I am working on a middleware API with the following requisites:
- I need to have only one incoming bean as a parameter
- I need to have only entry point to call like: execute(defaultBean)
- I have to possibles services (A or B) to call inside execute method based on this default bean
- Each service has their own bean parameter wich is very similar to my entry bean parameter
- The beans parameters of service A and B is similar, but not the same
- Based on my entry bean, I need to instantiate bean parameter A or B, and pass it to my service A or B
How you guys think is the best way to the client of API instantiate a bean, call my API execute() method, and my API knows if is needed invoke the service A or B, with their respectives parameters?
I already tried to use the Strategy Pattern, but my final client don't can instantiate the parameter A or B to pass to my API. Is necessary pass a default bean, and my API needs to know what service call, with the specific parameter.
Aucun commentaire:
Enregistrer un commentaire