Package org.springframework.data.domain
Class AbstractPageRequest
java.lang.Object
org.springframework.data.domain.AbstractPageRequest
- All Implemented Interfaces:
Serializable,Pageable
- Direct Known Subclasses:
PageRequest,QPageRequest
Abstract Java Bean implementation of
Pageable.- Author:
- Thomas Darimont, Oliver Gierke, Alex Bondarev, Johannes Englmeier, Thach Le
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractPageRequest(int pageNumber, int pageSize) Creates a newAbstractPageRequest. -
Method Summary
Modifier and TypeMethodDescriptionbooleanabstract Pageablefirst()Returns thePageablerequesting the first page.longReturns the offset to be taken according to the underlying page and page size.intReturns the page to be returned.intReturns the number of items to be returned.inthashCode()booleanReturns whether there's a previousPageablewe can access from the current one.abstract Pageablenext()abstract Pageableprevious()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.domain.Pageable
getSort, getSortOr, isPaged, isUnpaged, toLimit, toOptional, toScrollPosition, withPage
-
Constructor Details
-
AbstractPageRequest
public AbstractPageRequest(int pageNumber, int pageSize) Creates a newAbstractPageRequest. Pages are zero indexed, thus providing 0 forpageNumberwill 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.
-
-
Method Details
-
getPageSize
public int getPageSize()Description copied from interface:PageableReturns the number of items to be returned.- Specified by:
getPageSizein interfacePageable- Returns:
- the number of items of that page or throws
UnsupportedOperationExceptionif the object isPageable.isUnpaged().
-
getPageNumber
public int getPageNumber()Description copied from interface:PageableReturns the page to be returned.- Specified by:
getPageNumberin interfacePageable- Returns:
- the page to be returned or throws
UnsupportedOperationExceptionif the object isPageable.isUnpaged().
-
getOffset
public long getOffset()Description copied from interface:PageableReturns the offset to be taken according to the underlying page and page size.- Specified by:
getOffsetin interfacePageable- Returns:
- the offset to be taken or throws
UnsupportedOperationExceptionif the object isPageable.isUnpaged().
-
hasPrevious
public boolean hasPrevious()Description copied from interface:PageableReturns whether there's a previousPageablewe can access from the current one. Will return false in case the currentPageablealready refers to the first page.- Specified by:
hasPreviousin interfacePageable- Returns:
-
previousOrFirst
Description copied from interface:Pageable- Specified by:
previousOrFirstin interfacePageable- Returns:
-
next
Description copied from interface:Pageable -
previous
- Returns:
-
first
Description copied from interface:PageableReturns thePageablerequesting the first page. -
hashCode
public int hashCode() -
equals
-