mardi 19 juillet 2016

Configuration mechanism to flag the attributes of an object that should be synchronized

I'm refactoring a very old Java application. It has a component which is responsible for synchronizing a complex object with an object of the same type from a different source. The object has a lot of attributes (nearly hundred) of different types, including class types, which in turn have a lot of attributes.

I want to have the feature to tell the component which attributes of the object to synchronize or not. My first idea was dependency injection. But what should I inject? I don't want to have an interface with methods like public boolean synchronizeAttributeA(), public boolean synchronizeAttributeB() etc. for every attribute including the attributes of the compositions of the objects. How would you solve this issue in a nice and maintainable way?

Aucun commentaire:

Enregistrer un commentaire