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
    Returns the Pageable that can be used to request the first Page.
    int
    Returns the offset represented by the page number multiplied with the page size.
    int
    Returns the page to be returned.
    int
    Returns the number of elements per page to be returned.
    Returns the sorting that should be used for pagination.
    boolean
    Returns whether there is a previous Pageable i.e. if the page number is greater than 0.
    Returns the Pageable that can be used to request the next Page.
    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 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