org.datanucleus.query.evaluator
Class JavaQueryEvaluator

java.lang.Object
  extended by org.datanucleus.query.evaluator.JavaQueryEvaluator
Direct Known Subclasses:
JDOQLEvaluator, JPQLEvaluator

public abstract class JavaQueryEvaluator
extends java.lang.Object

Class to evaluate a Java "string-based" query in whole or part. Takes in a list of instances and applies the required restrictions to the input giving a final result. Typically extended for JDOQL, JPQL, SQL specifics.


Field Summary
protected  java.lang.String candidateAlias
           
protected  java.util.Collection candidates
          Candidates objects to evaluate.
protected  ClassLoaderResolver clr
           
protected  QueryCompilation compilation
          Compilation of the underlying query, that we are evaluating.
protected  InMemoryExpressionEvaluator evaluator
          The evaluator.
protected  java.lang.String language
           
protected static Localiser LOCALISER
          Localisation utility for output messages
protected  java.util.Map parameterValues
          Map of input parameter values, keyed by the parameter name.
protected  Query query
          Underlying "string-based" query.
static java.lang.String RESULTS_SET
          Name under which any set of results are stored in the state map.
protected  java.util.Map<java.lang.String,java.lang.Object> state
          Map of state symbols for the query evaluation.
 
Constructor Summary
JavaQueryEvaluator(java.lang.String language, Query query, QueryCompilation compilation, java.util.Map parameterValues, ClassLoaderResolver clr, java.util.Collection candidates)
          Constructor for the evaluator of a query in the specified language.
 
Method Summary
protected abstract  java.util.Collection evaluateSubquery(Query subquery, java.util.Collection candidates, QueryCompilation compilation)
          Method to evaluate a subquery of the query being evaluated.
 java.util.Collection execute(boolean applyFilter, boolean applyOrdering, boolean applyResult, boolean applyResultClass, boolean applyRange)
          Method to perform the evaluation, applying the query restrictions that are required.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation utility for output messages


RESULTS_SET

public static final java.lang.String RESULTS_SET
Name under which any set of results are stored in the state map. Used for aggregation.

See Also:
Constant Field Values

language

protected final java.lang.String language

candidateAlias

protected java.lang.String candidateAlias

candidates

protected java.util.Collection candidates
Candidates objects to evaluate.


query

protected Query query
Underlying "string-based" query.


compilation

protected QueryCompilation compilation
Compilation of the underlying query, that we are evaluating.


parameterValues

protected java.util.Map parameterValues
Map of input parameter values, keyed by the parameter name.


evaluator

protected InMemoryExpressionEvaluator evaluator
The evaluator.


state

protected java.util.Map<java.lang.String,java.lang.Object> state
Map of state symbols for the query evaluation.


clr

protected ClassLoaderResolver clr
Constructor Detail

JavaQueryEvaluator

public JavaQueryEvaluator(java.lang.String language,
                          Query query,
                          QueryCompilation compilation,
                          java.util.Map parameterValues,
                          ClassLoaderResolver clr,
                          java.util.Collection candidates)
Constructor for the evaluator of a query in the specified language.

Parameters:
language - Name of the language
query - The underlying query
compilation - Query compilation
parameterValues - Input parameter values
clr - ClassLoader resolver
candidates - Candidate objects
Method Detail

evaluateSubquery

protected abstract java.util.Collection evaluateSubquery(Query subquery,
                                                         java.util.Collection candidates,
                                                         QueryCompilation compilation)
Method to evaluate a subquery of the query being evaluated.

Parameters:
subquery - The subquery
candidates - The candidates for the subquery
compilation - The subquery compilation
Returns:
The result

execute

public java.util.Collection execute(boolean applyFilter,
                                    boolean applyOrdering,
                                    boolean applyResult,
                                    boolean applyResultClass,
                                    boolean applyRange)
Method to perform the evaluation, applying the query restrictions that are required.

Parameters:
applyFilter - Whether to apply any filter constraints on the results
applyOrdering - Whether to apply any order constraints on the results
applyResult - Whether to apply any result/grouping/having on the results
applyResultClass - Whether to apply any resultClass constraint on the results
applyRange - Whether to apply any range constraint on the results
Returns:
The results after evaluation.


Copyright © 2010. All Rights Reserved.