org.springframework.data.domain

## Class PageRequest

- java.lang.Object
- - org.springframework.data.domain.AbstractPageRequest
  - - org.springframework.data.domain.PageRequest

All Implemented Interfaces:
  Serializable, Pageable

    public class PageRequest
    extends AbstractPageRequest

Basic Java Bean implementation of `Pageable`.

Author:
  Oliver Gierke, Thomas Darimont
See Also:
  Serialized Form

### Constructor Summary

Constructors
`protected` `PageRequest(int page, int size, Sort sort)` Creates a new `PageRequest` with sort parameters applied.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `equals(Object obj)`
`Pageable` `first()` Returns the `Pageable` requesting the first page.
`Sort` `getSort()` Returns the sorting parameters.
`int` `hashCode()`
`Pageable` `next()` Returns the `Pageable` requesting the next `Page`.
`static PageRequest` `of(int page, int size)` Creates a new unsorted `PageRequest`.
`static PageRequest` `of(int page, int size, Sort.Direction direction, String... properties)` Creates a new `PageRequest` with sort direction and properties applied.
`static PageRequest` `of(int page, int size, Sort sort)` Creates a new `PageRequest` with sort parameters applied.
`PageRequest` `previous()` Returns the `Pageable` requesting the previous `Page`.
`String` `toString()`

### Methods inherited from class org.springframework.data.domain.AbstractPageRequest

`getOffset, getPageNumber, getPageSize, hasPrevious, previousOrFirst`

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.springframework.data.domain.Pageable

`getSortOr, isPaged, isUnpaged, toOptional, unpaged`

### Constructor Detail

#### PageRequest

    protected PageRequest(int page,
                          int size,
                          Sort sort)

Creates a new `PageRequest` with sort parameters applied.

Parameters:
  `page` - zero-based page index, must not be negative.
  `size` - the size of the page to be returned, must be greater than 0.
  `sort` - must not be null, use `Sort.unsorted()` instead.

### Method Detail

#### of

    public static PageRequest of(int page,
                                 int size)

Creates a new unsorted `PageRequest`.

Parameters:
  `page` - zero-based page index, must not be negative.
  `size` - the size of the page to be returned, must be greater than 0.
Since:
  2.0

#### of

    public static PageRequest of(int page,
                                 int size,
                                 Sort sort)

Creates a new `PageRequest` with sort parameters applied.

Parameters:
  `page` - zero-based page index.
  `size` - the size of the page to be returned.
  `sort` - must not be null, use `Sort.unsorted()` instead.
Since:
  2.0

#### of

    public static PageRequest of(int page,
                                 int size,
                                 Sort.Direction direction,
                                 String... properties)

Creates a new `PageRequest` with sort direction and properties applied.

Parameters:
  `page` - zero-based page index, must not be negative.
  `size` - the size of the page to be returned, must be greater than 0.
  `direction` - must not be null.
  `properties` - must not be null.
Since:
  2.0

#### 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 PageRequest 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:

#### equals

    public boolean equals(@Nullable
                          Object obj)

Overrides:
  `equals` in class `AbstractPageRequest`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `AbstractPageRequest`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`