I'm looking for a efficient way of retrieving an object for a specific class from a variable number of classes with a common parent.
in simple terms looking for Object of ClassA
Class B C and D all have method of different names to get said object. Sometimes I may need to access other objects within them to find my desired object.
I was just making a singleton class called
ObjectRetriever with one method called getObjectFromSource(Object source)
The method is currently just a series of if source instanceof ClassC to do specific behaviour.
I'm limited to how much source I can share but was hoping there is an existing pattern/design approach for this.
Aucun commentaire:
Enregistrer un commentaire