Class QPageRequest

java.lang.Object
org.springframework.data.domain.AbstractPageRequest
org.springframework.data.querydsl.QPageRequest
All Implemented Interfaces:
Serializable, Pageable

public class QPageRequest extends AbstractPageRequest
Basic Java Bean implementation of Pageable with support for QueryDSL.
Author:
Thomas Darimont, Oliver Drotbohm, Mark Paluch, Thach Le
See Also:
  • Constructor Details

    • QPageRequest

      @Deprecated public QPageRequest(int pageNumber, int pageSize)
      Deprecated.
      since 2.1, use of(int, int) instead.
      Creates a new QPageRequest. Pages are zero indexed, thus providing 0 for pageNumber will return the first pageNumber.
      Parameters:
      pageNumber - zero-based page number, must not be negative.
      pageSize - the size of the page to be returned, must be greater than 0.
    • QPageRequest

      @Deprecated public QPageRequest(int pageNumber, int pageSize, com.querydsl.core.types.OrderSpecifier<?>... orderSpecifiers)
      Deprecated.
      since 2.1, use of(int, int, OrderSpecifier...) instead.
      Creates a new QPageRequest with the given OrderSpecifiers applied.
      Parameters:
      pageNumber - zero-based page number, must not be negative.
      pageSize - the size of the page to be returned, must be greater than 0.
      orderSpecifiers - must not be null or empty;
    • QPageRequest

      @Deprecated public QPageRequest(int pageNumber, int pageSize, QSort sort)
      Deprecated.
      since 2.1, use of(int, int, QSort) instead.
      Creates a new QPageRequest with sort parameters applied.
      Parameters:
      pageNumber - zero-based page number, must not be negative.
      pageSize - the size of the page to be returned, must be greater than 0.
      sort - must not be null.
  • Method Details

    • of

      public static QPageRequest of(int pageNumber, int pageSize)
      Creates a new QPageRequest. Pages are zero indexed, thus providing 0 for pageNumber will return the first pageNumber.
      Parameters:
      pageNumber - zero-based page number, must not be negative.
      pageSize - the size of the page to be returned, must be greater than 0.
      Since:
      2.1
    • of

      public static QPageRequest of(int pageNumber, int pageSize, com.querydsl.core.types.OrderSpecifier<?>... orderSpecifiers)
      Creates a new QPageRequest with the given OrderSpecifiers applied.
      Parameters:
      pageNumber - zero-based page number, must not be negative.
      pageSize - the size of the page to be returned, must be greater than 0.
      orderSpecifiers - must not be null or empty;
      Since:
      2.1
    • of

      public static QPageRequest of(int pageNumber, int pageSize, QSort sort)
      Creates a new QPageRequest with sort parameters applied.
      Parameters:
      pageNumber - zero-based page number, must not be negative.
      pageSize - the size of the page to be returned, must be greater than 0.
      sort - must not be null.
      Since:
      2.1
    • ofSize

      public static QPageRequest ofSize(int pageSize)
      Creates a new QPageRequest for the first page (page number 0) given pageSize .
      Parameters:
      pageSize - the size of the page to be returned, must be greater than 0.
      Returns:
      a new QPageRequest.
      Since:
      2.5
    • getSort

      public Sort getSort()
      Description copied from interface: Pageable
      Returns the sorting parameters.
      Returns:
    • next

      public Pageable next()
      Description copied from interface: Pageable
      Returns the Pageable requesting the next Page.
      Specified by:
      next in interface Pageable
      Specified by:
      next in class AbstractPageRequest
      Returns:
    • previous

      public Pageable previous()
      Description copied from class: AbstractPageRequest
      Returns the Pageable requesting the previous Page.
      Specified by:
      previous in class AbstractPageRequest
      Returns:
    • first

      public Pageable first()
      Description copied from interface: Pageable
      Returns the Pageable requesting the first page.
      Specified by:
      first in interface Pageable
      Specified by:
      first in class AbstractPageRequest
      Returns:
    • withPage

      public QPageRequest withPage(int pageNumber)
      Creates a new QPageRequest with pageNumber applied.
      Parameters:
      pageNumber -
      Returns:
      a new PageRequest.
      Since:
      2.5
    • withSort

      public QPageRequest withSort(QSort sort)
      Creates a new QPageRequest with QSort applied.
      Parameters:
      sort - must not be null.
      Returns:
      a new PageRequest.
      Since:
      2.5