mercredi 15 juillet 2015

Avoiding Singleton in this Scenario in Java

I have a class ClassA whose object "ObjA" is created in only ClassB. Now there is a ClassX whose object is not created by me, but the framework, I pass the reference of a ClassX.class in one of the framework method, so the framework creates ClassX object at runtime, if required. Now I need to have the “ObjA” in ClassX. Can anyone suggest how I can pass this dependency to ClassX without making ClassA Singleton ?

Aucun commentaire:

Enregistrer un commentaire