I have an application that has an OrgManager interface that has an OrgManagerImpl not yet created
OrgManagerImpl should go and talk with some third-party REST API things that we donβt have access to yet.
So, while I am testing the web interface, I wrote mock OrgManagerImpl, which implements OrgManager, but in real time I will need to replace this implementation.
However, now I am in a situation where I want the servlet to choose an implementation of OrgManager, depending on some condition.
Also, when I call myOrgManager.findCompany ("SomeCompanyId"), I want myOrgManager to go and look at all the possible implementations to find a company and make a big list.
I would also like when I do myOrgManager.createCompany (company) to prefer one implementation over others.
It seems like I'm heading for the UserManagerManager object ... but I feel like it is probably missing some kind of Java design point or object oriented design that I should be aware of.
Can anyone suggest a template or strategy that I should use instead?
thanks
Tom h source share