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
{{ message }}
Repository navigation
CustomPropertyComparator should be used compare Collection items #747
Currently, CustomPropertyComparator is used only for comparing object properties, for example, it can be used to compare Person objects in boss property:
But it is not used by JaVers to compare Person objects when they are collection items in the partners List.
Possible solution is a new method in CustomPropertyComparator with default impl:
/** * This comparator is called by JaVers to calculate collection-to-collection diff. * <br/> * For example, when objects of type T are List items. * <br/><br/> * * Both equals() and compare() should return consistent results. When compare() returns null, * equals() should return false. * */defaultbooleanequals(Ta, Tb) {
returnObjects.equals(a, b);
}
Fixed in 5.0.1 when CustomPropertyComparator is used with LEVENSHTEIN.
CustomPropertyComparator can't be used with AS_SET because for comparing Sets, we need both equals() and hashCode() and CustomPropertyComparator implements only custom equals()
Activity
https://github.com/javers/javers/issues/747
https://github.com/javers/javers/issues/747
bartoszwalacik commentedon Nov 27, 2018
released in 4.0.0-RC3
baumgartner commentedon Dec 3, 2018
Works with ListCompareAlgorithm.SIMPLE
Assert fails for ListCompareAlgorithm.AS_SET and LEVENSHTEIN_DISTANCE.
Test-Project available at https://github.com/baumgartner/javerstest/blob/master/src/test/java/javers/test/ListCompareTest.java
bartoszwalacik commentedon Dec 3, 2018
omg, so we need a fix ...
https://github.com/javers/javers/issues/747
https://github.com/javers/javers/issues/747
bartoszwalacik commentedon Dec 5, 2018
Fixed in 5.0.1 when CustomPropertyComparator is used with LEVENSHTEIN.
CustomPropertyComparator can't be used with AS_SET because for comparing Sets, we need both equals() and hashCode() and CustomPropertyComparator implements only custom equals()
dmitry-weirdo commentedon Nov 25, 2020
@bartoszwalacik any perspective to also be able to use
CustomPropertyComparatortogether withCustomPropertyComparator?I described my case on #1038.