class CacheQuery extends java.lang.Object implements Query, StoreQuery
Modifier and Type | Class and Description |
---|---|
private static class |
CacheQuery.OrderingImpl
An attribute/direction pair
|
private class |
CacheQuery.StoreQueryImpl
StoreQuery implementation (essentially a snapshot of this (non-frozen) query builder
|
StoreQuery.Ordering
Modifier and Type | Field and Description |
---|---|
private java.util.List<Aggregator> |
aggregators |
private Cache |
cache |
private java.util.List<Criteria> |
criteria |
private boolean |
frozen |
private java.util.Set<Attribute<?>> |
groupByAttributes |
private java.util.Set<Attribute<?>> |
includedAttributes |
private boolean |
includeKeys |
private boolean |
includeValues |
private int |
maxResults |
private java.util.List<StoreQuery.Ordering> |
orderings |
Constructor and Description |
---|
CacheQuery(Cache cache)
Create a new builder instance
|
Modifier and Type | Method and Description |
---|---|
Query |
addCriteria(Criteria criteria)
Adds a criteria to the query
|
Query |
addGroupBy(Attribute<?>... attributes)
Group result set by unique value(s) of specified attribute(s).
|
Query |
addOrderBy(Attribute<?> attribute,
Direction direction)
Request result set ordering by the given attribute and direction.
|
private void |
assertFrozen() |
private void |
checkFrozen() |
private static java.util.List<AggregatorInstance<?>> |
createAggregatorInstances(java.util.List<Aggregator> aggregators) |
Query |
end()
Optional method for terminating query creation.
|
Results |
execute()
Execute this query.
|
java.util.List<AggregatorInstance<?>> |
getAggregatorInstances()
Get the requested aggregators
|
Cache |
getCache()
Get the cache this query originated from
|
Criteria |
getCriteria()
Get the search criteria
|
private Criteria |
getEffectiveCriteriaCopy() |
java.util.List<StoreQuery.Ordering> |
getOrdering()
Get the requested search orderings
|
java.util.Set<Attribute<?>> |
groupByAttributes()
Get the set of attributes to group result set by
|
Query |
includeAggregator(Aggregator... aggregators)
Request this query to aggregate the results by the given Aggregator(s)
This method may be called multiple times to request multiple aggregations
|
Query |
includeAttribute(Attribute<?>... attributes)
Request that the given attribute(s) should be present in the result for
this query.
|
Query |
includeKeys()
Request that the key object be present in the results.
|
Query |
includeValues()
Request that the value object be present in the results.
|
int |
maxResults()
Get the maximum number of results to return
|
Query |
maxResults(int maxResults)
Restrict the number of results returned from the search.
|
java.util.Set<Attribute<?>> |
requestedAttributes()
Get the set of attributes requested by this query
|
boolean |
requestsKeys()
Are keys requested?
|
boolean |
requestsValues()
Are values requested?
|
private StoreQuery |
snapshot() |
private volatile boolean frozen
private volatile boolean includeKeys
private volatile boolean includeValues
private volatile int maxResults
private final java.util.List<StoreQuery.Ordering> orderings
private final java.util.Set<Attribute<?>> includedAttributes
private final java.util.List<Criteria> criteria
private final java.util.List<Aggregator> aggregators
private final java.util.Set<Attribute<?>> groupByAttributes
private final Cache cache
public CacheQuery(Cache cache)
cache
- public Query includeKeys()
includeKeys
in interface Query
public Query includeValues()
includeValues
in interface Query
public Query includeAttribute(Attribute<?>... attributes)
Query.maxResults(int)
or by using Results.range(int, int)
rathern than Results.all()
includeAttribute
in interface Query
attributes
- the query attributes to selectpublic Query includeAggregator(Aggregator... aggregators) throws SearchException, AggregatorException
includeAggregator
in interface Query
SearchException
AggregatorException
public Query addOrderBy(Attribute<?> attribute, Direction direction)
addOrderBy
in interface Query
attribute
- The attribute to order the results bydirection
- Ascending or descendingpublic Query addGroupBy(Attribute<?>... attributes)
addGroupBy
in interface Query
public Query maxResults(int maxResults)
maxResults
clause to your query to limit the size.maxResults
in interface Query
maxResults
- the maximum number of results to returnpublic Query addCriteria(Criteria criteria)
addCriteria
in interface Query
public Results execute() throws SearchException
TimeoutBehaviorConfiguration.TimeoutBehaviorType.NOOP
and
TimeoutBehaviorConfiguration.TimeoutBehaviorType.LOCAL_READS
behaviorexecute
in interface Query
SearchException
public Query end()
public java.util.List<StoreQuery.Ordering> getOrdering()
getOrdering
in interface StoreQuery
public Criteria getCriteria()
getCriteria
in interface StoreQuery
public boolean requestsKeys()
requestsKeys
in interface StoreQuery
public boolean requestsValues()
requestsValues
in interface StoreQuery
public Cache getCache()
getCache
in interface StoreQuery
public java.util.Set<Attribute<?>> requestedAttributes()
requestedAttributes
in interface StoreQuery
public java.util.Set<Attribute<?>> groupByAttributes()
groupByAttributes
in interface StoreQuery
public int maxResults()
maxResults
in interface StoreQuery
public java.util.List<AggregatorInstance<?>> getAggregatorInstances()
getAggregatorInstances
in interface StoreQuery
private static java.util.List<AggregatorInstance<?>> createAggregatorInstances(java.util.List<Aggregator> aggregators)
private Criteria getEffectiveCriteriaCopy()
private void assertFrozen()
private StoreQuery snapshot()
private void checkFrozen()