T
- Options typeTCallable
- Callable typepublic abstract class WrapperQueryCallable<T extends Options,TCallable extends AbstractQueryCallable<T>> extends AbstractQueryCallable<T>
Note that we specifically prevent decoration of the call()
method
because we want it to call our versions of the relevant protected methods. If
we simply decorated this method and called call()
on the underlying
callable then its versions of those methods would be called rather than our
decorated versions and the decorator would have no effect.
Constructor and Description |
---|
WrapperQueryCallable(Runner<T> runner,
T options,
TCallable callable)
Creates a new decorator
|
Modifier and Type | Method and Description |
---|---|
QueryRun |
call()
Runs the Query counting the number of Results
|
protected long |
countResults(T options,
boolean result)
Counts the results for queries that return a boolean
|
protected long |
countResults(T options,
Model m)
Counts results for queries that return a model.
|
protected long |
countResults(T options,
ResultSet rset)
Counts results for queries that return a result set
|
protected QueryExecution |
createQueryExecution(Query query)
Creates the query execution to use for the query
|
protected void |
customizeRequest(QueryExecution qe)
Provides derived implementations the option to customize the query
execution before actually executing the query e.g.
|
protected Query |
getQuery()
Gets the query to be run
|
cancel, getOptions, getRunner, isCancelled
public final QueryRun call()
AbstractQueryCallable
call
in interface Callable<OperationRun>
call
in class AbstractQueryCallable<T extends Options>
protected Query getQuery()
AbstractQueryCallable
getQuery
in class AbstractQueryCallable<T extends Options>
protected long countResults(T options, boolean result)
AbstractQueryCallable
The default implementation always returns 1
countResults
in class AbstractQueryCallable<T extends Options>
options
- Optionsresult
- Resultprotected long countResults(T options, Model m)
AbstractQueryCallable
The default implementation returns the size of the model
countResults
in class AbstractQueryCallable<T extends Options>
options
- Optionsm
- Modelprotected long countResults(T options, ResultSet rset)
AbstractQueryCallable
The default implementation either returns OperationRun.UNKNOWN
if
the options indicate that counting is disabled or iterates over the
results to count them.
countResults
in class AbstractQueryCallable<T extends Options>
options
- Optionsrset
- Result Setprotected void customizeRequest(QueryExecution qe)
AbstractQueryCallable
The default implementation does nothing.
customizeRequest
in class AbstractQueryCallable<T extends Options>
qe
- Query Executionprotected QueryExecution createQueryExecution(Query query)
AbstractQueryCallable
createQueryExecution
in class AbstractQueryCallable<T extends Options>
query
- QueryCopyright © 2015. All rights reserved.