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 TypeMethodDescriptionbooleanstatic CassandraPageRequestfirst(int size) Creates a new unsortedPageRequestfor the first page.static CassandraPageRequestCreates a newPageRequestwith sort parameters applied for the first page.static CassandraPageRequestfirst(int size, Sort.Direction direction, String... properties) Creates a newPageRequestwith sort direction and properties applied for the first page.inthashCode()booleanhasNext()Returns whether there's a nextPageablewe can access from the current one.next()static CassandraPageRequestof(int page, int size) Creates a new unsortedPageRequest.static CassandraPageRequestCreates a newPageRequestwith sort parameters applied.static CassandraPageRequestof(int page, int size, Sort.Direction direction, String... properties) Creates a newPageRequestwith sort direction and properties applied.static CassandraPageRequestof(Pageable current, ByteBuffer pagingState) Creates a aPageRequestwith sort direction and properties applied.previous()toString()static voidvalidatePageable(Pageable pageable) Validate thePageablewhether it can be used for querying.Create a newCassandraPageRequestassociated withSortsort order.Methods inherited from class org.springframework.data.domain.PageRequest
first, getSort, ofSize, withPage, withSortMethods inherited from class org.springframework.data.domain.AbstractPageRequest
getOffset, getPageNumber, getPageSize, hasPrevious, previousOrFirstMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 newPageRequestwith 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 newPageRequestwith 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 aPageRequestwith sort direction and properties applied. -
first
Creates a new unsortedPageRequestfor the first page.- Parameters:
size- the size of the page to be returned.
-
first
Creates a newPageRequestwith 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 newPageRequestwith 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 thePageablewhether it can be used for querying. Valid pageables are either:- Unpaged
- Request the first page
CassandraPageRequestwith apaging state
- Parameters:
pageable-- Throws:
IllegalArgumentException- if thePageableis not valid.
-
getPagingState
- Returns:
- the
paging statefor the currentCassandraPageRequestor null if the currentPageablerepresents the last page.
-
hasNext
public boolean hasNext()Returns whether there's a nextPageablewe can access from the current one. Will return false in case the currentPageablealready refers to the next page.- Returns:
- true if there's a next
Pageablewe can access from the current one.
-
next
- Specified by:
nextin interfacePageable- Overrides:
nextin classPageRequest
-
withSort
Create a newCassandraPageRequestassociated withSortsort order.- Overrides:
withSortin classPageRequest- Parameters:
sort- must not be null.- Returns:
- a new
CassandraPageRequestassociated with the givenSort. - Since:
- 2.1.13
-
previous
- Overrides:
previousin classPageRequest
-
equals
- Overrides:
equalsin classPageRequest
-
hashCode
public int hashCode()- Overrides:
hashCodein classPageRequest
-
toString
- Overrides:
toStringin classPageRequest
-