Package com.onwbp.adaptation

# Class RequestPagination

java.lang.Object
com.onwbp.adaptation.RequestPagination

public final class RequestPagination extends Object
Performs paged navigation upon a request.

Since:
  5.8.0
See Also:
  - `Request.paginate()`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `RequestPagination.Page`
  Represents a page over a request.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RequestPagination.Page`
  `getFirstPage()`
  Returns the first page of the current request.
  `RequestPagination.Page`
  `getLastPage()`
  Returns the last page of the current request.
  `RequestPagination.Page`
  `getNextPage(Adaptation rowJustBeforePage)`
  Returns the page which contains the records just after the specified row.
  `RequestPagination.Page`
  `getNextPage(PrimaryKey rowJustBeforePage)`
  Returns the page which contains the records just after the specified row.
  `RequestPagination.Page`
  `getNextPage(RequestPagination.Page aPage)`
  Returns the page which contains the records just after the specified page.
  `int`
  `getPageSize()`
  Returns the maximum size of pages to be returned.
  `RequestPagination.Page`
  `getPreviousPage(Adaptation rowJustAfterPage)`
  Returns the page which contains the records just before the specified row.
  `RequestPagination.Page`
  `getPreviousPage(PrimaryKey rowJustAfterPage)`
  Returns the page which contains the records just before the specified row.
  `RequestPagination.Page`
  `getPreviousPage(RequestPagination.Page aPage)`
  Returns the page which contains the records just before the specified row.
  `void`
  `setPageSize(int aPageSize)`
  Specifies the size of pages to be returned.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getPageSize

    public int getPageSize()
    Returns the maximum size of pages to be returned.

  - ### setPageSize

    public void setPageSize(int aPageSize)
    Specifies the size of pages to be returned. The actual size of a returned page can be less than specified, if the end of the result has been reached.

    The default size is 10.

    Throws:
      `IllegalArgumentException` - if the specified size is not greater than 1.
    See Also:
      - `RequestPagination.Page.getSize()`

  - ### getFirstPage

    public RequestPagination.Page getFirstPage()
    Returns the first page of the current request.

  - ### getNextPage

    public RequestPagination.Page getNextPage(RequestPagination.Page aPage)
    Returns the page which contains the records just after the specified page.

    If there is no next page, returns the specified page.

  - ### getNextPage

    public RequestPagination.Page getNextPage(PrimaryKey rowJustBeforePage)
    Returns the page which contains the records just after the specified row. Returns `null` if no record exists for the specified row key: the client code should take into account the case where the record has been deleted since the row key was registered.
    Throws:
      `IllegalArgumentException` - if the specified row is `null`.

  - ### getNextPage

    public RequestPagination.Page getNextPage(Adaptation rowJustBeforePage)
    Returns the page which contains the records just after the specified row.
    Throws:
      `IllegalArgumentException` - if the specified row is `null`, or is not a record.

  - ### getPreviousPage

    public RequestPagination.Page getPreviousPage(RequestPagination.Page aPage)
    Returns the page which contains the records just before the specified row.

    If the first page is reached, reinvokes the method `getFirstPage()`, so as to return a full page.

  - ### getPreviousPage

    public RequestPagination.Page getPreviousPage(PrimaryKey rowJustAfterPage)
    Returns the page which contains the records just before the specified row. Returns `null` if no record exists for the specified row key: the client code should take into account the case where the record has been deleted since the row key was registered.

    If the first page is reached, reinvokes the method `getFirstPage()`, so as to return a full page.

    Throws:
      `IllegalArgumentException` - if the specified row key is `null`.

  - ### getPreviousPage

    public RequestPagination.Page getPreviousPage(Adaptation rowJustAfterPage)
    Returns the page which contains the records just before the specified row.

    If the first page is reached, reinvokes the method `getFirstPage()`, so as to return a full page.

    Throws:
      `IllegalArgumentException` - if the specified row is `null`, or is not a record.

  - ### getLastPage

    public RequestPagination.Page getLastPage()
    Returns the last page of the current request.