Class Query
java.lang.Object
org.springframework.data.cassandra.core.query.Query
- All Implemented Interfaces:
Iterable<CriteriaDefinition>
,Supplier<Stream<CriteriaDefinition>>
,Filter
,Streamable<CriteriaDefinition>
Query object representing
CriteriaDefinition
s, Columns
, Sort
, paging state
and QueryOptions
for a CQL query. Query
is created with a fluent API creating immutable objects.-
Method Summary
Modifier and TypeMethodDescriptionand
(CriteriaDefinition criteriaDefinition) Add the givenCriteriaDefinition
to the currentQuery
.static Query
empty()
Static factory method to create an emptyQuery
.boolean
long
getLimit()
getSort()
int
hashCode()
boolean
boolean
limit
(long limit) Limit the number of returned rows tolimit
.Limit the number of returned rows toLimit
.pageRequest
(Pageable pageable) Create aQuery
initialized with aPageRequest
to fetch the first page of results or advance in paging along with sorting.pagingState
(ByteBuffer pagingState) Set thepaging state
to skip rows.pagingState
(CassandraScrollPosition scrollPosition) Set thepaging state
to skip rows.static Query
query
(Iterable<? extends CriteriaDefinition> criteriaDefinitions) Static factory method to create aQuery
using the providedCriteriaDefinition
.static Query
query
(CriteriaDefinition... criteriaDefinitions) Static factory method to create aQuery
using the providedCriteriaDefinition
.queryOptions
(QueryOptions queryOptions) Set theQueryOptions
.protected boolean
querySettingsEquals
(Query that) Tests whether the settings of the givenQuery
are equal to this query.toString()
Allow filtering withthis
Query
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
empty
Static factory method to create an emptyQuery
.- Returns:
- a new, empty
Query
.
-
query
Static factory method to create aQuery
using the providedCriteriaDefinition
.- Parameters:
criteriaDefinitions
- must not be null.- Returns:
- the
Query
forCriteriaDefinition
s.
-
query
Static factory method to create aQuery
using the providedCriteriaDefinition
.- Parameters:
criteriaDefinitions
- must not be null.- Returns:
- the
Query
forCriteriaDefinition
s.
-
and
Add the givenCriteriaDefinition
to the currentQuery
.- Parameters:
criteriaDefinition
- must not be null.- Returns:
- a new
Query
object containing the former settings withCriteriaDefinition
applied.
-
getCriteriaDefinitions
- Specified by:
getCriteriaDefinitions
in interfaceFilter
- Returns:
- the
CriteriaDefinition
s.
-
columns
AddColumns
to theQuery
instance. Existing definitions are merged or overwritten for overridingColumnName
s incolumns
. -
getColumns
- Returns:
- the query
Columns
.
-
sort
-
getSort
- Returns:
- the query
Sort
object.
-
pageRequest
Create aQuery
initialized with aPageRequest
to fetch the first page of results or advance in paging along with sorting. Reads (and overrides, if set)page size
intoQueryOptions#getPageSize()
and setspagingState
andSort
.- Parameters:
pageable
- must not be null.- Returns:
- a new
Query
object containing the former settings withPageRequest
applied. - See Also:
-
pagingState
Set thepaging state
to skip rows.- Parameters:
scrollPosition
- must not be null.- Returns:
- a new
Query
object containing the former settings with paging state applied.
-
pagingState
Set thepaging state
to skip rows.- Parameters:
pagingState
- must not be null.- Returns:
- a new
Query
object containing the former settings withpaging state
applied.
-
getPagingState
- Returns:
- the optional
paging state
.
-
queryOptions
Set theQueryOptions
.- Parameters:
queryOptions
- must not be null.- Returns:
- a new
Query
object containing the former settings withQueryOptions
applied.
-
getQueryOptions
- Returns:
- the optional
QueryOptions
.
-
limit
Limit the number of returned rows tolimit
.- Parameters:
limit
-- Returns:
- a new
Query
object containing the former settings withlimit
applied.
-
limit
Limit the number of returned rows toLimit
.- Parameters:
limit
-- Returns:
- a new
Query
object containing the former settings withlimit
applied.
-
getLimit
public long getLimit()- Returns:
- the maximum number of rows to be returned.
-
isLimited
public boolean isLimited()- Returns:
true
if the query is limited.
-
withAllowFiltering
Allow filtering withthis
Query
.- Returns:
- a new
Query
object containing the former settings withallowFiltering
applied.
-
isAllowFiltering
public boolean isAllowFiltering()- Returns:
- true to allow filtering.
-
equals
-
querySettingsEquals
Tests whether the settings of the givenQuery
are equal to this query.- Parameters:
that
-- Returns:
-
hashCode
public int hashCode() -
toString
-