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, Thach Le
- See Also:
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedPageRequest(int pageNumber, int pageSize, Sort sort) Creates a newPageRequestwith sort parameters applied.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanfirst()Returns thePageablerequesting the first page.getSort()Returns the sorting parameters.inthashCode()next()static PageRequestof(int pageNumber, int pageSize) Creates a new unsortedPageRequest.static PageRequestCreates a newPageRequestwith sort parameters applied.static PageRequestof(int pageNumber, int pageSize, Sort.Direction direction, String... properties) Creates a newPageRequestwith sort direction and properties applied.static PageRequestofSize(int pageSize) previous()toString()withPage(int pageNumber) Creates a newPageRequestwithpageNumberapplied.Creates a newPageRequestwithSortapplied.withSort(Sort.Direction direction, String... properties) Methods inherited from class org.springframework.data.domain.AbstractPageRequestgetOffset, getPageNumber, getPageSize, hasPrevious, previousOrFirstMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.data.domain.PageablegetSortOr, isPaged, isUnpaged, toLimit, toOptional, toScrollPosition
- 
Constructor Details- 
PageRequestCreates a newPageRequestwith 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, use- Sort.unsorted()instead.
 
 
- 
- 
Method Details- 
ofCreates a new unsortedPageRequest.- 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.0
 
- 
ofCreates a newPageRequestwith 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, use- Sort.unsorted()instead.
- Since:
- 2.0
 
- 
ofpublic static PageRequest of(int pageNumber, int pageSize, Sort.Direction direction, String... properties) Creates a newPageRequestwith sort direction and properties 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.
- 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
 
- 
getSortDescription copied from interface:PageableReturns the sorting parameters.- Returns:
- the sorting order.
 
- 
nextDescription copied from interface:Pageable
- 
previousDescription copied from class:AbstractPageRequest- Specified by:
- previousin class- AbstractPageRequest
- Returns:
- the previous Pageable
 
- 
firstDescription copied from interface:PageableReturns thePageablerequesting the first page.- Specified by:
- firstin interface- Pageable
- Specified by:
- firstin class- AbstractPageRequest
- Returns:
- the Pageablerequesting the first page.
 
- 
withPageCreates a newPageRequestwithpageNumberapplied.- Parameters:
- pageNumber- the page number to apply.
- Returns:
- a new PageRequest.
- Since:
- 2.5
 
- 
withSort@Contract("_, _ -> new") @CheckReturnValue public PageRequest withSort(Sort.Direction direction, String... properties) - Parameters:
- direction- must not be null.
- properties- must not be null.
- Returns:
- a new PageRequest.
- Since:
- 2.5
 
- 
withSortCreates a newPageRequestwithSortapplied.- Parameters:
- sort- must not be null.
- Returns:
- a new PageRequest.
- Since:
- 2.5
 
- 
equals- Overrides:
- equalsin class- AbstractPageRequest
 
- 
hashCodepublic int hashCode()- Overrides:
- hashCodein class- AbstractPageRequest
 
- 
toString
 
-