public final class QueryPlus<T> extends Object
Query
+ extra stuff needed in QueryRunner
s. This "extra stuff"
is only QueryMetrics
yet.Modifier and Type | Method and Description |
---|---|
Query<T> |
getQuery() |
QueryMetrics<?> |
getQueryMetrics() |
Sequence<T> |
run(QuerySegmentWalker walker,
Map<String,Object> context) |
QueryPlus<T> |
withoutThreadUnsafeState()
Returns a QueryPlus object without the components which are unsafe for concurrent use from multiple threads,
therefore couldn't be passed down in concurrent or async
QueryRunner s. |
<U> QueryPlus<U> |
withQuery(Query<U> replacementQuery)
Returns a QueryPlus object with
QueryMetrics from this QueryPlus object, and the provided Query . |
QueryPlus<T> |
withQueryMetrics(QueryToolChest<T,? extends Query<T>> queryToolChest)
Returns the same QueryPlus object, if it already has
QueryMetrics (getQueryMetrics() returns not
null), or returns a new QueryPlus object with Query from this QueryPlus and QueryMetrics created using the
given QueryToolChest , via QueryToolChest.makeMetrics(Query) method. |
QueryPlus<T> |
withQuerySegmentSpec(QuerySegmentSpec spec)
Equivalent of withQuery(getQuery().withQuerySegmentSpec(spec)).
|
static <T> QueryPlus<T> |
wrap(Query<T> query)
Returns the minimum bare QueryPlus object with the given query.
|
public static <T> QueryPlus<T> wrap(Query<T> query)
getQueryMetrics()
of the QueryPlus object,
returned from this factory method, returns null
.@Nullable public QueryMetrics<?> getQueryMetrics()
public QueryPlus<T> withQueryMetrics(QueryToolChest<T,? extends Query<T>> queryToolChest)
QueryMetrics
(getQueryMetrics()
returns not
null), or returns a new QueryPlus object with Query
from this QueryPlus and QueryMetrics created using the
given QueryToolChest
, via QueryToolChest.makeMetrics(Query)
method.
By convention, callers of withQueryMetrics()
must also call .getQueryMetrics().emit() on the returned
QueryMetrics object, regardless if this object is the same as the object on which .withQueryMetrics() was initially
called (i. e. it already had non-null QueryMetrics), or if it is a new QueryPlus object. See MetricsEmittingQueryRunner
for example.public QueryPlus<T> withoutThreadUnsafeState()
QueryRunner
s.
Currently the only unsafe component is QueryMetrics
, i. e. withoutThreadUnsafeState()
call is
equivalent to withoutQueryMetrics()
.public QueryPlus<T> withQuerySegmentSpec(QuerySegmentSpec spec)
public <U> QueryPlus<U> withQuery(Query<U> replacementQuery)
QueryMetrics
from this QueryPlus object, and the provided Query
.Copyright © 2011–2018. All rights reserved.