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
- See Also:
-
Constructor Summary
-
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()
-
Constructor Details
-
AbstractPageRequest
public AbstractPageRequest(int page, int size) Creates a newAbstractPageRequest
. Pages are zero indexed, thus providing 0 forpage
will return the first page.- Parameters:
page
- must not be less than zero.size
- must not be less than one.
-
-
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
-