Interface Pageable

All Known Subinterfaces:
KeysetPageable
All Known Implementing Classes:
KeysetPageRequest, PageRequest

public interface Pageable
Interface containing pagination information, heavily inspired by Spring Data's Pageable.
Since:
1.2.0
Author:
Christian Beikov
  • Method Summary

    Modifier and Type Method Description
    Pageable first()
    Returns the Pageable that can be used to request the first Page.
    int getOffset()
    Returns the offset represented by the page number multiplied with the page size.
    int getPageNumber()
    Returns the page to be returned.
    int getPageSize()
    Returns the number of elements per page to be returned.
    Sort getSort()
    Returns the sorting that should be used for pagination.
    boolean hasPrevious()
    Returns whether there is a previous Pageable i.e. if the page number is greater than 0.
    Pageable next()
    Returns the Pageable that can be used to request the next Page.
    Pageable previous()
    Returns the Pageable that can be used to request the previous Page or null if the current one already is the first one.
    Pageable previousOrFirst()
    Returns the Pageable that can be used to request the previous Page or the first if the current one already is the first one.
  • Method Details

    • getPageNumber

      int getPageNumber()
      Returns the page to be returned. Zero based.
      Returns:
      The page to be returned.
    • getPageSize

      int getPageSize()
      Returns the number of elements per page to be returned.
      Returns:
      The number of elements per page
    • getOffset

      int getOffset()
      Returns the offset represented by the page number multiplied with the page size.
      Returns:
      The offset
    • getSort

      Sort getSort()
      Returns the sorting that should be used for pagination.
      Returns:
      The sorting
    • next

      Pageable next()
      Returns the Pageable that can be used to request the next Page.
      Returns:
      The Pageable for the next Page
    • previous

      Pageable previous()
      Returns the Pageable that can be used to request the previous Page or null if the current one already is the first one.
      Returns:
      The Pageable for the previous Page
    • previousOrFirst

      Pageable previousOrFirst()
      Returns the Pageable that can be used to request the previous Page or the first if the current one already is the first one.
      Returns:
      The Pageable for the previous or first Page
    • first

      Pageable first()
      Returns the Pageable that can be used to request the first Page.
      Returns:
      The Pageable for the first Page
    • hasPrevious

      boolean hasPrevious()
      Returns whether there is a previous Pageable i.e. if the page number is greater than 0.
      Returns:
      Whether there is a previous page