Class CassandraPageRequest
java.lang.Object
org.springframework.data.domain.AbstractPageRequest
org.springframework.data.domain.PageRequest
org.springframework.data.cassandra.core.query.CassandraPageRequest
- All Implemented Interfaces:
Serializable
,Pageable
Cassandra-specific
PageRequest
implementation providing access to paging state
. This class
allows creation of the first page request and represents through Cassandra paging is based on the progress of fetched
pages and allows forward-only navigation. Accessing a particular page requires fetching of all pages until the
desired page is reached.
The fetching progress is represented as paging state
. Query results are associated with a
paging state
that is used on the next query
as input parameter to continue page fetching.
- Since:
- 2.0
- Author:
- Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static CassandraPageRequest
first
(int size) Creates a new unsortedPageRequest
for the first page.static CassandraPageRequest
Creates a newPageRequest
with sort parameters applied for the first page.static CassandraPageRequest
first
(int size, Sort.Direction direction, String... properties) Creates a newPageRequest
with sort direction and properties applied for the first page.int
hashCode()
boolean
hasNext()
Returns whether there's a nextPageable
we can access from the current one.next()
static CassandraPageRequest
of
(int page, int size) Creates a new unsortedPageRequest
.static CassandraPageRequest
Creates a newPageRequest
with sort parameters applied.static CassandraPageRequest
of
(int page, int size, Sort.Direction direction, String... properties) Creates a newPageRequest
with sort direction and properties applied.static CassandraPageRequest
of
(Pageable current, ByteBuffer pagingState) Creates a aPageRequest
with sort direction and properties applied.previous()
toString()
static void
validatePageable
(Pageable pageable) Validate thePageable
whether it can be used for querying.Create a newCassandraPageRequest
associated withSort
sort order.Methods inherited from class org.springframework.data.domain.PageRequest
first, getSort, ofSize, withPage, withSort
Methods inherited from class org.springframework.data.domain.AbstractPageRequest
getOffset, getPageNumber, getPageSize, hasPrevious, previousOrFirst
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.data.domain.Pageable
getSortOr, isPaged, isUnpaged, toOptional
-
Method Details
-
of
Creates a new unsortedPageRequest
.- Parameters:
page
- zero-based page index.size
- the size of the page to be returned.- Throws:
IllegalArgumentException
- for page requests other than the first page.
-
of
Creates a newPageRequest
with sort parameters applied.- Parameters:
page
- zero-based page index.size
- the size of the page to be returned.sort
- must not be null.- Throws:
IllegalArgumentException
- for page requests other than the first page.
-
of
public static CassandraPageRequest of(int page, int size, Sort.Direction direction, String... properties) Creates a newPageRequest
with sort direction and properties applied.- Parameters:
page
- zero-based page index.size
- the size of the page to be returned.direction
- must not be null.properties
- must not be null.- Throws:
IllegalArgumentException
- for page requests other than the first page.
-
of
Creates a aPageRequest
with sort direction and properties applied. -
first
Creates a new unsortedPageRequest
for the first page.- Parameters:
size
- the size of the page to be returned.
-
first
Creates a newPageRequest
with sort parameters applied for the first page.- Parameters:
size
- the size of the page to be returned.sort
- must not be null.
-
first
Creates a newPageRequest
with sort direction and properties applied for the first page.- Parameters:
size
- the size of the page to be returned.direction
- must not be null.properties
- must not be null.
-
validatePageable
Validate thePageable
whether it can be used for querying. Valid pageables are either:- Unpaged
- Request the first page
CassandraPageRequest
with apaging state
- Parameters:
pageable
-- Throws:
IllegalArgumentException
- if thePageable
is not valid.
-
getPagingState
- Returns:
- the
paging state
for the currentCassandraPageRequest
or null if the currentPageable
represents the last page.
-
hasNext
public boolean hasNext()Returns whether there's a nextPageable
we can access from the current one. Will return false in case the currentPageable
already refers to the next page.- Returns:
- true if there's a next
Pageable
we can access from the current one.
-
next
- Specified by:
next
in interfacePageable
- Overrides:
next
in classPageRequest
-
withSort
Create a newCassandraPageRequest
associated withSort
sort order.- Overrides:
withSort
in classPageRequest
- Parameters:
sort
- must not be null.- Returns:
- a new
CassandraPageRequest
associated with the givenSort
. - Since:
- 2.1.13
-
previous
- Overrides:
previous
in classPageRequest
-
equals
- Overrides:
equals
in classPageRequest
-
hashCode
public int hashCode()- Overrides:
hashCode
in classPageRequest
-
toString
- Overrides:
toString
in classPageRequest
-