Class SortMapper


  • public abstract class SortMapper
    extends Object
    This mapper provides methods to transform a SortOrder into a Sort object from the Spring framework (spring-data-common) and vice versa.
    Author:
    Christian Bremer
    • Method Detail

      • toSort

        public static org.springframework.data.domain.Sort toSort​(SortOrders sortOrders)
        Transforms sort orders into a Sort object.
        Parameters:
        sortOrders - the sort orders
        Returns:
        the sort
      • toSort

        public static org.springframework.data.domain.Sort toSort​(List<? extends SortOrder> sortOrders)
        Transforms the sort order into a Sort object.
        Parameters:
        sortOrders - the sort orders
        Returns:
        the sort object
      • fromSort

        public static List<SortOrder> fromSort​(org.springframework.data.domain.Sort sort)
        Transforms a Sort object into a sort order list.
        Parameters:
        sort - the Sort object
        Returns:
        the sort order list
      • toSortOrder

        public static org.springframework.data.domain.Sort.Order toSortOrder​(SortOrder sortOrder)
        Transforms the sort order into a Sort.Order object.
        Parameters:
        sortOrder - the sort order
        Returns:
        the sort object
      • fromSortOrder

        public static SortOrder fromSortOrder​(org.springframework.data.domain.Sort.Order sortOrder)
        Transforms a Sort.Order object into a sort order.
        Parameters:
        sortOrder - the Sort.Order object
        Returns:
        the sort order
      • applyDefaults

        public static org.springframework.data.domain.Pageable applyDefaults​(org.springframework.data.domain.Pageable source,
                                                                             Boolean asc,
                                                                             Boolean ignoreCase,
                                                                             Boolean nullIsFirst,
                                                                             String... properties)
        Apply defaults to page request.
        Parameters:
        source - the source
        asc - the asc
        ignoreCase - the ignore case
        nullIsFirst - the null is first
        properties - the properties
        Returns:
        the pageable
      • applyDefaults

        public static org.springframework.data.domain.Sort applyDefaults​(org.springframework.data.domain.Sort source,
                                                                         Boolean asc,
                                                                         Boolean ignoreCase,
                                                                         Boolean nullIsFirst,
                                                                         String... properties)
        Apply defaults to sort.
        Parameters:
        source - the source
        asc - the asc
        ignoreCase - the ignore-case flag
        nullIsFirst - the null is first flag
        properties - the properties
        Returns:
        the sort