You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sebastian Gröbler edited this page Jun 19, 2013
·
8 revisions
This little framework was born out of the need to be able to log create and update operations on entities in order to bring visibility into the behaviour of an application. It is based on the java-diff-utils in such that it will generate a unified diff with no contextual lines.
This framework allows to compare any two Java objects. Aside from the actual diff algorithm, diffing two Java objects basically comes down to two problems:
Serialization
The java-diff-utils framework works with lists of strings. A list of strings represents a document. In order to create a document out of a Java object it needs to be serialized and the serialization must produce a human readable output. This framework allows to specify custom serializers which are used to serialize objects in the to be diffed object graph. The set of properties that will be diffed on each object in the graph is defined through the readable properties on these objects. A readable property is a bean property that has a public getter.
Order
There are certain Java structures (e.g. HashMap, HashSet) which do not define order. To produce consistent diff results one needs to make sure that unordered structures are ordered before serialization. The framework allows to specify comparators or comparables which are used to order Iterable and Mapobjects.