Class SortOrders


  • @Valid
    public class SortOrders
    extends Object
    The list of sort orders.
    Author:
    Christian Bremer
    • Constructor Detail

      • SortOrders

        protected SortOrders()
        Instantiates an empty list of sort orders.
      • SortOrders

        public SortOrders​(Collection<? extends SortOrder> sortOrders)
        Instantiates a new unmodifiable list of sort orders.
        Parameters:
        sortOrders - the sort orders
    • Method Detail

      • getSortOrders

        public List<SortOrder> getSortOrders()
        Gets the unmodifiable list of sort orders.
        Returns:
        the list of sort orders
      • isEmpty

        public boolean isEmpty()
        Checks whether the list of sort orders is empty or not.
        Returns:
        true if the list of sort orders is empty, otherwise false
      • isSorted

        public boolean isSorted()
        Checks whether this sort orders contains any entries. If there are entries, this is sorted, otherwise it is unsorted.
        Returns:
        true if the list of sort orders is not empty (aka sorted), otherwise false
      • isUnsorted

        public boolean isUnsorted()
        Checks whether this sort orders contains any entries. If there are no entries, this is unsorted, otherwise it is sorted.
        Returns:
        true if the list of sort orders is empty (aka unsorted), otherwise false
      • toSortOrdersText

        @NotEmpty
        public @NotEmpty String toSortOrdersText()
        Creates the sort orders text of this ordering descriptions.

        The syntax of the ordering description is

         fieldNameOrPath0,asc,ignoreCase,nullIsFirst;fieldNameOrPath1,asc,ignoreCase,nullIsFirst
         

        For example

         room.number,asc,true,false;person.lastName,asc,true,false;person.firstName,asc,true,false
         
        Returns:
        the sort orders text
      • toSortOrdersText

        @NotEmpty
        public @NotEmpty String toSortOrdersText​(SortOrdersTextProperties properties)
        Creates the sort orders text of this ordering descriptions.

        The syntax of the ordering description is

         fieldNameOrPath0,asc,ignoreCase,nullIsFirst;fieldNameOrPath1,asc,ignoreCase,nullIsFirst
         

        The separators (',') and (';') and the values of direction, case-handling and null-handling depend on the given SortOrdersTextProperties.

        For example with default properties:

         room.number,asc,true,false;person.lastName,asc,true,false;person.firstName,asc,true,false
         
        Parameters:
        properties - the properties
        Returns:
        the sort orders text
      • fromSortOrdersText

        public static SortOrders fromSortOrdersText​(String source)
        From sort orders text.
        Parameters:
        source - the sort orders text
        Returns:
        the sort orders
      • fromSortOrdersText

        public static SortOrders fromSortOrdersText​(String source,
                                                    SortOrdersTextProperties properties)
        From sort orders text.
        Parameters:
        source - the sort orders text
        properties - the properties
        Returns:
        the sort orders
      • by

        public static SortOrders by​(SortOrder... sortOrders)
        Creates new sort orders with the given orders.
        Parameters:
        sortOrders - the sort orders
        Returns:
        the sort orders