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
ConstructorDescriptionAbstractPageRequest
(int pageNumber, int pageSize) Creates a newAbstractPageRequest
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
abstract Pageable
first()
Returns thePageable
requesting the first page.long
Returns the offset to be taken according to the underlying page and page size.int
Returns the page to be returned.int
Returns the number of items to be returned.int
hashCode()
boolean
Returns whether there's a previousPageable
we can access from the current one.abstract Pageable
next()
abstract Pageable
previous()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.domain.Pageable
getSort, getSortOr, isPaged, isUnpaged, toOptional, toScrollPosition, withPage
-
Constructor Details
-
AbstractPageRequest
public AbstractPageRequest(int pageNumber, int pageSize) Creates a newAbstractPageRequest
. Pages are zero indexed, thus providing 0 forpageNumber
will 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:Pageable
Returns the number of items to be returned.- Specified by:
getPageSize
in interfacePageable
- Returns:
- the number of items of that page or throws
UnsupportedOperationException
if the object isPageable.isUnpaged()
.
-
getPageNumber
public int getPageNumber()Description copied from interface:Pageable
Returns the page to be returned.- Specified by:
getPageNumber
in interfacePageable
- Returns:
- the page to be returned or throws
UnsupportedOperationException
if the object isPageable.isUnpaged()
.
-
getOffset
public long getOffset()Description copied from interface:Pageable
Returns the offset to be taken according to the underlying page and page size.- Specified by:
getOffset
in interfacePageable
- Returns:
- the offset to be taken or throws
UnsupportedOperationException
if the object isPageable.isUnpaged()
.
-
hasPrevious
public boolean hasPrevious()Description copied from interface:Pageable
Returns whether there's a previousPageable
we can access from the current one. Will return false in case the currentPageable
already refers to the first page.- Specified by:
hasPrevious
in interfacePageable
- Returns:
-
previousOrFirst
Description copied from interface:Pageable
- Specified by:
previousOrFirst
in interfacePageable
- Returns:
-
next
Description copied from interface:Pageable
-
previous
- Returns:
-
first
Description copied from interface:Pageable
Returns thePageable
requesting the first page. -
hashCode
public int hashCode() -
equals
-