How to use java-object-diff library to compare object graph involving one-to-many relationships implemented using lists? -


Text after "div class =" itemprop = "text">

I have been working in 'complex objects' under different graphs, and 'base' copies to compare and one Make changes logs. From Stackoverflow, I saw that java-object-diff library () can work for me, I've skimmed through available documentation / examples, but I'm still not clear about this:

1. How does it compare to the collection?
2. Is the order of items relevant in the collection?
3. How can 'equal' methods be used instead of introspection?

For example, if I have 'user' and 'role' object then the user can have multiple roles both override the 'equal' method using both their identifiers. Can compare different copies of users with related roles?

After

  1. Comparison is compiled using its items and hash code methods for each item A so-called DiffNode and will be represented by either inscribed , marked by added , deleted or Change . If an object (with identical identities) gets in the base and works, then it will be checked for changes and it will be marked as UNTOUCHED or CHANGED . Otherwise it will be marked as ADDED or REMOVED respectively. A library is a feature that supports the order of objects and multiple events in a collection. It will basically treat all collection types as the set and examine the presence of an object. Unless you do not care about the order or need to insert an item several times in the same collection, this should not be a problem.
  2. Not yet. But an advanced list defender is definitely possible and I'm dreaming for some time. This is just a pretty complicated topic and I have not yet got to do this
  3. There are several ways:. You can comment your type with your property gateter with @ObjectDiffEqualsOnlyType or @ObjectDiffProperty (equalsOnly = true) . or withEqualsOnlyProperty (Last PropertyPath propertyPath) withEqualsOnlyType (type;; & gt; Lt) can do this by using Code> Configuration . The upcoming version will come with a fluent configuration API to make the configuration easier and more powerful to create this kind of

about your example. Given that you will return two versions of user to object defifier , java-object-diff will return a node (root node), which is the user Represents. As long as you do not mark the user class as equal-only-type, it is computed on a per-asset basis only. Each property will end as a child of the root node. Now suppose that one of the qualities is a list of roles: the library will be grouped and the items present in the working version (known objects), which are only present in the base version (deleted) And which are present only in the work version (Added). This is done by comparing items through either the methods / methods / methods of the underlying compilation / directly equivalent . Then the "known" items will be checked for changes, this can be a simple call for equal or a deep comparison with introspection; Depending on the type it is configured for given type.


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -