public interface Pageable
Modifier and Type | Method and Description |
---|---|
Pageable |
first()
Returns the
Pageable requesting the first page. |
long |
getOffset()
Returns the offset to be taken according to the underlying page and page size.
|
int |
getPageNumber()
Returns the page to be returned.
|
int |
getPageSize()
Returns the number of items to be returned.
|
Sort |
getSort()
Returns the sorting parameters.
|
default Sort |
getSortOr(Sort sort)
Returns the current
Sort or the given one if the current one is unsorted. |
boolean |
hasPrevious()
Returns whether there's a previous
Pageable we can access from the current one. |
default boolean |
isPaged()
Returns whether the current
Pageable contains pagination information. |
default boolean |
isUnpaged()
Returns whether the current
Pageable does not contain pagination information. |
Pageable |
next()
|
static Pageable |
ofSize(int pageSize)
|
Pageable |
previousOrFirst()
|
default Optional<Pageable> |
toOptional()
Returns an
Optional so that it can easily be mapped on. |
static Pageable |
unpaged()
Returns a
Pageable instance representing no pagination setup. |
Pageable |
withPage(int pageNumber)
Creates a new
Pageable with pageNumber applied. |
static Pageable unpaged()
Pageable
instance representing no pagination setup.static Pageable ofSize(int pageSize)
pageSize
- the size of the page to be returned, must be greater than 0.Pageable
.default boolean isPaged()
Pageable
contains pagination information.default boolean isUnpaged()
Pageable
does not contain pagination information.int getPageNumber()
UnsupportedOperationException
if the object is
isUnpaged()
.UnsupportedOperationException
- if the object is isUnpaged()
.int getPageSize()
UnsupportedOperationException
if the object is
isUnpaged()
.UnsupportedOperationException
- if the object is isUnpaged()
.long getOffset()
UnsupportedOperationException
if the object is
isUnpaged()
.UnsupportedOperationException
- if the object is isUnpaged()
.Sort getSort()
default Sort getSortOr(Sort sort)
Sort
or the given one if the current one is unsorted.sort
- must not be null.Pageable next()
Pageable previousOrFirst()
Pageable withPage(int pageNumber)
Pageable
with pageNumber
applied.pageNumber
- PageRequest
or throws UnsupportedOperationException
if the object is
isUnpaged()
and the pageNumber
is not zero.UnsupportedOperationException
- if the object is isUnpaged()
.boolean hasPrevious()
Pageable
we can access from the current one. Will return
false in case the current Pageable
already refers to the first page.Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.