![]() ![]() You suddenly realize that you need to scan the objects recursively, figure out which collection items have been added, removed or changed find a way to return your results in a way that allows you to easily access the information you are looking for and provide accessors to apply changes. What if you need to find differences in collections or maps? What if you have to deal with nested objects that also need to be compared on a per-property basis? Or even worse: what if you need to merge such objects? However, there are some cases that can increase the complexity dramatically. After all, we want to keep things simple, don't we? ![]() In many cases this is a perfectly valid strategy and the way to go. One of the simplest solutions that'll cross your mind is most certainly to use reflection to scan the object for fields or getters and use them to compare the values of the different object instances. ![]() Sometimes you need to figure out, how one version of an object differs from another one. This tree can then be traversed to extract more information or apply changes to the underlying data structures. It takes two objects and generates a tree structure that represents any differences between the objects and their children. Java-object-diff is a simple, yet powerful library to find differences between Java objects. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |