mardi 4 juillet 2017

Is there a way to reuse code if my objects have different hierarchy?

My problem is that I am dealing with 2 different jaxb generated object hierarchies. The objects have the same name and 99.9% the same structure but they are in different packages:

 xy.z.fpml.transparency.IdentifiedCurrency
 xy.z.fpml.recordkeeping.IdentifiedCurrency

As you might imagine I can't modify the objects and they have nothing in common that I can link to, no superclass or interface, etc

IntelliJ says it is duplicate code but I have my hands tied. Is there any way to do kind of a generic method that will accept both kind of objects ? Maybe some reflection ? ( I am asumming I can't ...)





Aucun commentaire:

Enregistrer un commentaire