public class CassandraPageRequest extends PageRequest
PageRequest
implementation providing access to PagingState
. 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 PagingState
. Query results
are associated with a paging state
that is used on the
next query as input parameter to continue page fetching.Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static CassandraPageRequest |
first(int size)
Creates a new unsorted
PageRequest for the first page. |
static CassandraPageRequest |
first(int size,
Sort.Direction direction,
String... properties)
Creates a new
PageRequest with sort direction and properties applied for the first page. |
static CassandraPageRequest |
first(int size,
Sort sort)
Creates a new
PageRequest with sort parameters applied for the first page. |
com.datastax.driver.core.PagingState |
getPagingState() |
int |
hashCode() |
boolean |
hasNext()
Returns whether there's a next
Pageable we can access from the current one. |
CassandraPageRequest |
next() |
static CassandraPageRequest |
of(int page,
int size)
Creates a new unsorted
PageRequest . |
static CassandraPageRequest |
of(int page,
int size,
Sort.Direction direction,
String... properties)
Creates a new
PageRequest with sort direction and properties applied. |
static CassandraPageRequest |
of(int page,
int size,
Sort sort)
Creates a new
PageRequest with sort parameters applied. |
static CassandraPageRequest |
of(Pageable current,
com.datastax.driver.core.PagingState pagingState)
Creates a a
PageRequest with sort direction and properties applied. |
PageRequest |
previous() |
String |
toString() |
static void |
validatePageable(Pageable pageable)
Validate the
Pageable whether it can be used for querying. |
first, getSort
getOffset, getPageNumber, getPageSize, hasPrevious, previousOrFirst
public static CassandraPageRequest of(int page, int size)
PageRequest
.page
- zero-based page index.size
- the size of the page to be returned.IllegalArgumentException
- for page requests other than the first page.public static CassandraPageRequest of(int page, int size, Sort sort)
PageRequest
with sort parameters applied.page
- zero-based page index.size
- the size of the page to be returned.sort
- must not be null.IllegalArgumentException
- for page requests other than the first page.public static CassandraPageRequest of(int page, int size, Sort.Direction direction, String... properties)
PageRequest
with sort direction and properties applied.page
- zero-based page index.size
- the size of the page to be returned.direction
- must not be null.properties
- must not be null.IllegalArgumentException
- for page requests other than the first page.public static CassandraPageRequest of(Pageable current, @Nullable com.datastax.driver.core.PagingState pagingState)
PageRequest
with sort direction and properties applied.public static CassandraPageRequest first(int size)
PageRequest
for the first page.size
- the size of the page to be returned.public static CassandraPageRequest first(int size, Sort sort)
PageRequest
with sort parameters applied for the first page.size
- the size of the page to be returned.sort
- must not be null.public static CassandraPageRequest first(int size, Sort.Direction direction, String... properties)
PageRequest
with sort direction and properties applied for the first page.size
- the size of the page to be returned.direction
- must not be null.properties
- must not be null.public static void validatePageable(Pageable pageable)
Pageable
whether it can be used for querying. Valid pageables are either:
CassandraPageRequest
with a PagingState
pageable
- IllegalArgumentException
- if the Pageable
is not valid.@Nullable public com.datastax.driver.core.PagingState getPagingState()
PagingState
for the current CassandraPageRequest
or null if the current
Pageable
represents the last page.public boolean hasNext()
Pageable
we can access from the current one. Will return false in
case the current Pageable
already refers to the next page.Pageable
we can access from the current one.public CassandraPageRequest next()
next
in interface Pageable
next
in class PageRequest
public PageRequest previous()
previous
in class PageRequest
public boolean equals(@Nullable Object obj)
equals
in class PageRequest
public int hashCode()
hashCode
in class PageRequest
public String toString()
toString
in class PageRequest
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.