Comparator
| src | 5 years ago | ||
| .gitignore | 5 years ago | ||
| README.md | 5 years ago | ||
| lombok.config | 5 years ago | ||
| pom.xml | 5 years ago | ||
Compare objects by annotated member variables. Non-annotated members will be ignored.
public class User {
@Comparable
private String name;
}
Instantiate
Comparator comparator = new Comparator(object1, object2);
Is Equal
boolean equal = comparator.isEqual()
Differences
List<Diff> diffs = comparator.compare();
Diff
Objects other than boxed types and Strings can be marked as @Comparable.
public class User {
@Comparable
private Address address;
}
public class Address {
@Comparable
private String city;
private String state;
}
A runtime ComparatorException will be thrown if two object of different classes are being compared.
Add Collection, Array, and Map handling