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.-
Method Summary
Modifier and TypeMethodDescriptionand(CriteriaDefinition criteriaDefinition) Add the givenCriteriaDefinitionto the currentQuery.static Queryempty()Static factory method to create an emptyQuery.booleanlonggetLimit()getSort()inthashCode()booleanlimit(long limit) 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(ByteBuffer pagingState) 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.toString()Allow filtering withthisQuery.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 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
- Returns:
- the query
Columns.
-
sort
-
getSort
- Returns:
- the query
Sortobject.
-
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:
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.
-
getLimit
public long getLimit()- Returns:
- the maximum number of rows to be returned.
-
withAllowFiltering
Allow filtering withthisQuery.- Returns:
- a new
Queryobject containing the former settings withallowFilteringapplied.
-
isAllowFiltering
public boolean isAllowFiltering()- Returns:
- true to allow filtering.
-
equals
-
querySettingsEquals
Tests whether the settings of the givenQueryare equal to this query.- Parameters:
that-- Returns:
-
hashCode
public int hashCode() -
toString
-