[ 
https://issues.apache.org/jira/browse/LANG-1758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17895583#comment-17895583
 ] 

Gary D. Gregory commented on LANG-1758:
---------------------------------------

Hello [~crizzis],

I think any change in behavior should be opt-in which your proposal seems to 
offer.

This feature might trickle in a few interesting places and we should consider 
if we need offer a ComparableBuilder that falls back on equals() has a backstop 
or bake in the Comparable option differently. This needs more think and 
experimenting.


> 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ń
>            Priority: Minor
>
> 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)

Reply via email to