SQiShER / java-object-diff

Library to diff and merge Java objects with ease
http://sqisher.github.io/java-object-diff/
Apache License 2.0
942 stars 178 forks source link

Instance, or List of Instances, of a Class inside a Class - Creating Diff #198

Open RA-AlexRees opened 6 years ago

RA-AlexRees commented 6 years ago

Hi there, I have a class which has instances of other classes declared inside. An example is below:

public class Person {

public int personID;
public String personName;
public String personCode;
public Transports transports;
public Categories categories;
public List<Insurance> insurance;

}

Transports, Categories & Insurance, are an instances, or list of instances, of a class, which can include another class inside, if that makes sense?

What I would like to have done is get the difference between 2 Person classes, whilst going in to the nested classes and only returning the difference.

I hope this makes sense!

Thanks, Alex

nitin-b commented 6 years ago

I also have a similar requirement. Have you found a way to get it working? Without a way to find out exact difference in a particular property of 'Insurance' in the above example, the java object comparison isn't useful for me.

jianhong-li commented 4 years ago

This feature is supported. but you should implement the interface: de.danielbechler.diff.identity.IdentityStrategy