Class ComparisonValueExtractor<T,​E extends Number>

    • Field Detail

      • m_comparator

        protected Comparator m_comparator
        An underlying Comparator object (optional).
    • Constructor Detail

      • ComparisonValueExtractor

        public ComparisonValueExtractor()
        Default constructor (necessary for the ExternalizableLite interface).
      • ComparisonValueExtractor

        public ComparisonValueExtractor​(String sMethod1,
                                        String sMethod2)
        Construct a ComparisonValueExtractor based on two method names. Note: values returned by both methods must be Comparable.
        Parameters:
        sMethod1 - the name of the first method to invoke via reflection
        sMethod2 - the name of the second method to invoke via reflection
      • ComparisonValueExtractor

        public ComparisonValueExtractor​(String sMethod1,
                                        String sMethod2,
                                        Comparator<? super E> comp)
        Construct a ComparisonValueExtractor based on two method names and a Comparator object.
        Parameters:
        sMethod1 - the name of the first method to invoke via reflection
        sMethod2 - the name of the second method to invoke via reflection
        comp - the comparator used to compare the extracted values (optional)
      • ComparisonValueExtractor

        public ComparisonValueExtractor​(ValueExtractor<T,​E> ve1,
                                        ValueExtractor<T,​E> ve2)
        Construct a ComparisonValueExtractor based on two specified extractors. Note: values returned by both extractors must be Comparable.
        Parameters:
        ve1 - the ValueExtractor for the first value
        ve2 - the ValueExtractor for the second value
      • ComparisonValueExtractor

        public ComparisonValueExtractor​(ValueExtractor<T,​E> ve1,
                                        ValueExtractor<T,​E> ve2,
                                        Comparator<? super E> comp)
        Construct a ComparisonValueExtractor based on two specified extractors and a Comparator object.
        Parameters:
        ve1 - the ValueExtractor for the first value
        ve2 - the ValueExtractor for the second value
        comp - the comparator used to compare the extracted values (optional)
    • Method Detail

      • getComparator

        public Comparator getComparator()
        Return a Comparator used by this extractor.
        Returns:
        a Comparator used by this extractor; null if the natural value comparison should be used
      • extract

        public E extract​(Object oTarget)
        Extract the value from the passed object. The returned value may be null. For intrinsic types, the returned value is expected to be a standard wrapper type in the same manner that reflection works; for example, int would be returned as a java.lang.Integer.
        Specified by:
        extract in interface ValueExtractor<T,​E extends Number>
        Overrides:
        extract in class AbstractExtractor<T,​E extends Number>
        Parameters:
        oTarget - the object to extract the value from
        Returns:
        the extracted value; null is an acceptable value