Package org.springframework.data.domain
Class PageRequest
java.lang.Object
org.springframework.data.domain.AbstractPageRequest
org.springframework.data.domain.PageRequest
- All Implemented Interfaces:
Serializable
,Pageable
Basic Java Bean implementation of
Pageable
.- Author:
- Oliver Gierke, Thomas Darimont, Anastasiia Smirnova, Mark Paluch
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
PageRequest
(int page, int size, Sort sort) Creates a newPageRequest
with sort parameters applied. -
Method Summary
Modifier and TypeMethodDescriptionboolean
first()
Returns thePageable
requesting the first page.getSort()
Returns the sorting parameters.int
hashCode()
next()
static PageRequest
of
(int page, int size) Creates a new unsortedPageRequest
.static PageRequest
Creates a newPageRequest
with sort parameters applied.static PageRequest
of
(int page, int size, Sort.Direction direction, String... properties) Creates a newPageRequest
with sort direction and properties applied.static PageRequest
ofSize
(int pageSize) previous()
toString()
withPage
(int pageNumber) Creates a newPageRequest
withpageNumber
applied.Creates a newPageRequest
withSort
applied.withSort
(Sort.Direction direction, String... properties) 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, toScrollPosition
-
Constructor Details
-
PageRequest
Creates a newPageRequest
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, useSort.unsorted()
instead.
-
-
Method Details
-
of
Creates a new unsortedPageRequest
.- 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
Creates a newPageRequest
with sort parameters applied.- Parameters:
page
- zero-based page index.size
- the size of the page to be returned.sort
- must not be null, useSort.unsorted()
instead.- Since:
- 2.0
-
of
Creates a newPageRequest
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
-
ofSize
- Parameters:
pageSize
- the size of the page to be returned, must be greater than 0.- Returns:
- a new
PageRequest
. - Since:
- 2.5
-
getSort
Description copied from interface:Pageable
Returns the sorting parameters.- Returns:
-
next
Description copied from interface:Pageable
- Specified by:
next
in interfacePageable
- Specified by:
next
in classAbstractPageRequest
- Returns:
-
previous
Description copied from class:AbstractPageRequest
- Specified by:
previous
in classAbstractPageRequest
- Returns:
-
first
Description copied from interface:Pageable
Returns thePageable
requesting the first page.- Specified by:
first
in interfacePageable
- Specified by:
first
in classAbstractPageRequest
- Returns:
-
equals
- Overrides:
equals
in classAbstractPageRequest
-
withPage
Creates a newPageRequest
withpageNumber
applied.- Parameters:
pageNumber
-- Returns:
- a new
PageRequest
. - Since:
- 2.5
-
withSort
- Parameters:
direction
- must not be null.properties
- must not be null.- Returns:
- a new
PageRequest
. - Since:
- 2.5
-
withSort
Creates a newPageRequest
withSort
applied.- Parameters:
sort
- must not be null.- Returns:
- a new
PageRequest
. - Since:
- 2.5
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractPageRequest
-
toString
-