Class Order


  • public class Order
    extends Object
    PropertyPath implements the pairing of an Direction and a property. It is used to provide input for Sorting. See Spring Data Commons, but more flat design and independent of Spring libraries.
    • Method Detail

      • defaultBuilder

        public static OrderBuilder defaultBuilder()
      • getDirection

        public Direction getDirection()
        Returns the order the property shall be sorted for.
        Returns:
        the order the property shall be sorted for
      • getNullHandling

        public NullHandling getNullHandling()
        Returns the used NullHandling hint, which can but may not be respected by the used datastore.
        Returns:
        the used NullHandling hint, which can but may not be respected by the used datastore.
      • getProperty

        public String getProperty()
        Returns the property to order for.
        Returns:
        the property to order for
      • getSubProperty

        public Optional<String> getSubProperty()
        Returns the optional sub property to order for.

        A sub property is always related to the main property.

        Returns:
        the optional sub property to order for
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • ignoreCase

        public Order ignoreCase()
        Returns a new Order with case insensitive sorting enabled.
        Returns:
        a new Order with case insensitive sorting enabled
      • isAscending

        public boolean isAscending()
        Returns whether sorting for this property shall be ascending.
        Returns:
        whether sorting for this property shall be ascending
      • isDescending

        public boolean isDescending()
        Returns whether sorting for this property shall be descending.
        Returns:
        whether sorting for this property shall be descending
      • isIgnoreCase

        public boolean isIgnoreCase()
        Returns whether or not the sort will be case sensitive.
        Returns:
        whether or not the sort will be case sensitive
      • nullsFirst

        public Order nullsFirst()
        Returns a Order with NullHandling.NULLS_FIRST as null handling hint.
        Returns:
        an Order with NullHandling#NULLS_FIRST as null handling hint
      • nullsLast

        public Order nullsLast()
        Returns a Order with NullHandling.NULLS_LAST as null handling hint.
        Returns:
        an Order with NullHandling#NULLS_LAST as null handling hint.
      • nullsNative

        public Order nullsNative()
        Returns a Order with NullHandling.NATIVE as null handling hint.
        Returns:
        an Order with NullHandling#NATIVE as null handling hint.
      • setDirection

        public void setDirection​(Direction direction)
      • setIgnoreCase

        public void setIgnoreCase​(boolean ignoreCase)
      • setNullHandling

        public void setNullHandling​(NullHandling nullHandling)
      • setProperty

        public void setProperty​(String property)
      • setSubProperty

        public void setSubProperty​(String property)
      • with

        public Order with​(Direction direction)
        Returns a new Order with the given Direction.
        Parameters:
        direction - given direction
        Returns:
        a new Order with the given Direction
      • with

        public Order with​(NullHandling nullHandling)
        Returns a Order with the given NullHandling.
        Parameters:
        nullHandling - can be null.
        Returns:
        an Order with the given NullHandling
      • withProperties

        public Sorting withProperties​(String... properties)
        Returns a new Sorting instance for the given properties.
        Parameters:
        properties - given properties
        Returns:
        a new Sorting for the given properties
      • withProperty

        public Order withProperty​(String property)
        Returns a new Order
        Parameters:
        property - must not be null or empty.
        Returns:
        a new Order