Class ComparableEqualityFunction<T extends java.lang.Comparable<? super T>>

  • All Implemented Interfaces:
    EntityValueEqualityFunction<T>, java.util.function.BiFunction<T,​T,​java.lang.Boolean>

    public class ComparableEqualityFunction<T extends java.lang.Comparable<? super T>>
    extends java.lang.Object
    implements EntityValueEqualityFunction<T>
    This Function overrides the default Bid Field comparison of using equals() with compare(). It is needed because BigDecimals' equals() takes into account the number's scale, which means
    0.0 != 0.00
    This can cause strange behaviours, especially when comparing UI values against DB values.
    Using compare() instead solves this problem as it ignores scale when the values are the same.

    Created by yuvalr on 5/22/16.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Boolean apply​(T bigDecimal, T bigDecimal2)  
      static <T extends java.lang.Comparable<? super T>>
      ComparableEqualityFunction<T>
      getInstance()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.BiFunction

        andThen
    • Method Detail

      • apply

        public java.lang.Boolean apply​(T bigDecimal,
                                       T bigDecimal2)
        Specified by:
        apply in interface java.util.function.BiFunction<T extends java.lang.Comparable<? super T>,​T extends java.lang.Comparable<? super T>,​java.lang.Boolean>