Class ComparatorBuilder

    • Constructor Detail

      • ComparatorBuilder

        public ComparatorBuilder()
    • Method Detail

      • asc

        public ComparatorBuilder asc​(String sExpr)
        Add comparator to this builder.
        Parameters:
        sExpr - expression used to create an expression extractor
        Returns:
        this ComparatorBuilder
      • asc

        public ComparatorBuilder asc​(ValueExtractor extractor)
        Add comparator to this builder.
        Parameters:
        extractor - extractor used to extract values
        Returns:
        this ComparatorBuilder
      • desc

        public ComparatorBuilder desc​(String sExpr)
        Add comparator to builder.
        Parameters:
        sExpr - expression used to create expression extractor
        Returns:
        this ComparatorBuilder
      • desc

        public ComparatorBuilder desc​(ValueExtractor extractor)
        Add comparator to this builder.
        Parameters:
        extractor - extractor used to extract values
        Returns:
        this ComparatorBuilder
      • build

        public Comparator build()
        Build comparator.
        Returns:
        comparator representing current state of builder
      • add

        protected void add​(Comparator comparator)
        Append specified comparator to the end of list of comparators owned by this builder.
        Parameters:
        comparator - comparator to add
      • inverse

        protected Comparator inverse​(Comparator comparator)
        Reverse ordering of a given comparator.
        Parameters:
        comparator - comparator to be reversed
        Returns:
        a reversed comparator
      • createComparator

        protected Comparator createComparator​(String sExpr)
        Create extractor comparator.
        Parameters:
        sExpr - expression used to create expression extractor
        Returns:
        comparator that will evaluate given expression when comparing values
      • createComparator

        protected Comparator createComparator​(ValueExtractor extractor)
        Create extractor comparator.
        Parameters:
        extractor - extractor used while comparing values
        Returns:
        comparator that will use given extractor when comparing values
      • safe

        protected Comparator safe​(Comparator comparator)
        Wrap given comparator with a SafeComparator.
        Parameters:
        comparator - to be wrapped
        Returns:
        SafeComparator wrapping given comparator
      • createExtractor

        protected ValueExtractor createExtractor​(String sExpr)
        Create expression extractor.
        Parameters:
        sExpr - expression to create extractor for
        Returns:
        extractor for the specified expression