Task: I get xml from external API. Demarchal it into a chain of inherited objects. I work with these objects. At a certain stage, I need to check in which objects the changes were made, and send back to api xml only from the modified objects.
What ideas came to mind: Working with hashcode - save object hashes at the time of their generation from xml. And before sending, again, take the hash of objects, and check if it has changed. But while I see the problem that if the hash of the child changes, then the parent hash also changes, and as a result I’ll throw back the entire tree of the inherited objects.
To do some sort of object marker. If in one of the object fields the new value is changed, then change the marker to true. In this case, is there a universal way or template for the implementation of this idea? Hardcoding it all in all setreters seems like a bad idea.
Question: What is the best way to track changes in objects? Can someone share their experience or link?