You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Krzysztof Sierszeń (Jira)" <ji...@apache.org> on 2024/11/05 12:02:00 UTC

[jira] [Created] (LANG-1758) Enable use of compareTo to test for BigDecimal equality in ReflectionDiffBuilder

Krzysztof Sierszeń created LANG-1758:
----------------------------------------

             Summary: Enable use of compareTo to test for BigDecimal equality in ReflectionDiffBuilder
                 Key: LANG-1758
                 URL: https://issues.apache.org/jira/browse/LANG-1758
             Project: Commons Lang
          Issue Type: Improvement
            Reporter: Krzysztof Sierszeń


ATM all fields seem to be compared using equals in `org.apache.commons.lang3.builder.ReflectionDiffBuilder`. 

However, comparing BigDecimals using compareTo (i.e. ignoring precision) is such a common use case, that I feel this could be a configuration option for `ReflectionDiffBuilder`. 

I can also think of two more generic alternatives:
#  a config option like `.usingComparatorForType(Class<T>, Comparator<? super T>)`
# compare *all* `Comparable` types using `compareTo` rather than `equals` (potentially also configurable via an option like `.preferCompareToOverEquals(bool)`



--
This message was sent by Atlassian Jira
(v8.20.10#820010)