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
CriteriaDefinitions, Columns, Sort, paging state
and QueryOptions for a CQL query. Query is created with a fluent API creating immutable objects.- Since:
- 2.0
- Author:
- Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionand(CriteriaDefinition criteriaDefinition) Add the givenCriteriaDefinitionto the currentQuery.static Queryempty()Static factory method to create an emptyQuery.booleanlonggetLimit()getSort()inthashCode()booleanbooleanlimit(long limit) Limit the number of returned rows tolimit.Limit the number of returned rows toLimit.pageRequest(Pageable pageable) Create aQueryinitialized with aPageRequestto fetch the first page of results or advance in paging along with sorting.pagingState(com.datastax.oss.driver.api.core.cql.PagingState pagingState) Set thepaging stateto skip rows.pagingState(ByteBuffer pagingState) Set thepaging stateto skip rows.pagingState(CassandraScrollPosition scrollPosition) Set thepaging stateto skip rows.static Queryquery(Iterable<? extends CriteriaDefinition> criteriaDefinitions) Static factory method to create aQueryusing the providedCriteriaDefinition.static Queryquery(CriteriaDefinition... criteriaDefinitions) Static factory method to create aQueryusing the providedCriteriaDefinition.queryOptions(QueryOptions queryOptions) Set theQueryOptions.protected booleanquerySettingsEquals(Query that) Tests whether the settings of the givenQueryare equal to this query.static <T> QueryStatic factory method to create aQueryfor the given column selection.static QueryStatic factory method to create aQueryfor the given column selection.static <T> Queryselect(TypedPropertyPath<T, ?>... properties) Static factory method to create aQueryfor the given column selection.toString()Allow filtering withthisQuery.Methods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
empty
-
select
Static factory method to create aQueryfor the given column selection. -
select
-
select
-
query
Static factory method to create aQueryusing the providedCriteriaDefinition.- Parameters:
criteriaDefinitions- must not be null.- Returns:
- the
QueryforCriteriaDefinitions.
-
query
Static factory method to create aQueryusing the providedCriteriaDefinition.- Parameters:
criteriaDefinitions- must not be null.- Returns:
- the
QueryforCriteriaDefinitions.
-
and
Add the givenCriteriaDefinitionto the currentQuery.- Parameters:
criteriaDefinition- must not be null.- Returns:
- a new
Queryobject containing the former settings withCriteriaDefinitionapplied.
-
getCriteriaDefinitions
- Specified by:
getCriteriaDefinitionsin interfaceFilter- Returns:
- the
CriteriaDefinitions.
-
columns
AddColumnsto theQueryinstance. Existing definitions are merged or overwritten for overridingColumnNames incolumns. -
getColumns
-
sort
-
getSort
-
pageRequest
Create aQueryinitialized with aPageRequestto fetch the first page of results or advance in paging along with sorting. Reads (and overrides, if set)page sizeintoQueryOptions#getPageSize()and setspagingStateandSort.- Parameters:
pageable- must not be null.- Returns:
- a new
Queryobject containing the former settings withPageRequestapplied. - See Also:
-
pagingState
Set thepaging stateto skip rows.- Parameters:
scrollPosition- must not be null.- Returns:
- a new
Queryobject containing the former settings with paging state applied.
-
pagingState
@CheckReturnValue public Query pagingState(com.datastax.oss.driver.api.core.cql.PagingState pagingState) Set thepaging stateto skip rows.- Parameters:
pagingState- must not be null.- Returns:
- a new
Queryobject containing the former settings withpaging stateapplied. - Since:
- 5.0
-
pagingState
Set thepaging stateto skip rows.- Parameters:
pagingState- must not be null.- Returns:
- a new
Queryobject containing the former settings withpaging stateapplied.
-
getPagingState
- Returns:
- the optional
paging state.
-
queryOptions
Set theQueryOptions.- Parameters:
queryOptions- must not be null.- Returns:
- a new
Queryobject containing the former settings withQueryOptionsapplied.
-
getQueryOptions
- Returns:
- the optional
QueryOptions.
-
limit
Limit the number of returned rows tolimit.- Parameters:
limit-- Returns:
- a new
Queryobject containing the former settings withlimitapplied.
-
limit
-
getLimit
public long getLimit()- Returns:
- the maximum number of rows to be returned.
-
isLimited
public boolean isLimited()- Returns:
trueif the query is limited.
-
withAllowFiltering
-
isAllowFiltering
public boolean isAllowFiltering()- Returns:
- true to allow filtering.
-
equals
-
querySettingsEquals
-
hashCode
-
toString
-