Allow CustomValueComparators to handle nulls
See original GitHub issueCurrently, before calling a CustomValueComparator impl, Javers checks nulls and assumes that :
null != any non-null value
This assumption simplifies an impl, but from the other hand it makes impossible to write a Comparator which treats nulls as empty values. See https://stackoverflow.com/questions/66497652/javers-comparison-string-collection-and-boolean-with-defined-rules
public interface CustomValueComparator<T> {
/**
* Called by JaVers to compare two Values.
*
* @param a not null
* @param b not null
*/
boolean equals(T a, T b);
New feature Skip the Javers internal null-safety logic and allow passing nulls to CustomValueComparators.
Unfortunately it could break existing users’ code
Test case CaseWithCustomComparatorBlejwas.groovy
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (6 by maintainers)
Top Results From Across the Web
CustomValueComparator not called, when attribute is null in ...
I'm using Javers to compare two object having a String attribute. Since in my application an empty String and a null value in...
Read more >Release notes — JaVers Documentation
1075 Added a new feature which allows CustomValueComparators to handle nulls: ... Javers skips that logic and * allows a comparator to handle...
Read more >How to Use Comparison Operators with NULLs in SQL
Let's get started by reviewing NULL values in SQL. ... To handle NULLs correctly, SQL provides two special comparison operators: IS NULL and ......
Read more >Javers Compare String Null And "" Empty String - ADocLib
javers/javers.github.io 4 #1075 Allow CustomValueComparators to handle nulls.#1075 This comment begins the outline of the approach. To allow nulls you can ...
Read more >Best way to handle nulls in Java? [closed]
Or something that allows erroneous code to be somehow acceptable. Can you explain how erroneous code is not getting fixed? What's the political ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks @bartoszwalacik - and good point. I’ll make the naming more straightforward as suggested. I’ll get a PR raised presently.
Ok @ratskinmahoney, your design looks good, but maybe we can avoid double negations?