java.lang.Object
es.kukenan.smartfi.microservice.smartficore.util.PageUtils

public class PageUtils extends Object
Page utilities for pagination search.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static int
    Default page size in paginated request where page size is not specified.
    private static final String
    Error message for ian invalid sorting criteria specification.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.springframework.data.domain.PageRequest
    page(Integer pageNumber, Integer pageSize, org.springframework.data.domain.Sort sort)
    Create a Pageable instance from the given paging specification.
    static org.springframework.data.domain.Sort
    sortedBy(String sortedByClause)
    Create a Sort instance from the given sorting specification.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SORT_ERROR

      private static final String SORT_ERROR
      Error message for ian invalid sorting criteria specification.
      See Also:
    • defaultPageSize

      @Value("${query.pagination.pageSize.default}") private static int defaultPageSize
      Default page size in paginated request where page size is not specified.
  • Constructor Details

    • PageUtils

      public PageUtils()
  • Method Details

    • sortedBy

      public static org.springframework.data.domain.Sort sortedBy(String sortedByClause)
      Create a Sort instance from the given sorting specification.
      Parameters:
      sortedByClause - the sorting specification.
      Returns:
      the Sort instance from the given sorting specification.
    • page

      public static org.springframework.data.domain.PageRequest page(Integer pageNumber, Integer pageSize, org.springframework.data.domain.Sort sort)
      Create a Pageable instance from the given paging specification.
      Parameters:
      pageNumber - page number, optional default 0.
      pageSize - page size, optional default defaultPageSize.
      sort - sorting, optional.
      Returns:
      the page request for the given paging specification.