Class JavaQueryInMemoryEvaluator

  • Direct Known Subclasses:
    JDOQLInMemoryEvaluator, JPQLInMemoryEvaluator

    public abstract class JavaQueryInMemoryEvaluator
    extends Object
    Class to evaluate a Java "string-based" query in whole or part. Takes in the "generic" compilation, a list of instances and applies the required restrictions to the input giving a final result. Typically extended for JDOQL, JPQL specifics.
    • Field Detail

      • RESULTS_SET

        public static final 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 String language
      • candidateAlias

        protected String candidateAlias
      • candidates

        protected 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 Map parameterValues
        Map of input parameter values, keyed by the parameter name.
      • state

        protected Map<String,​Object> state
        Map of state symbols for the query evaluation.
    • Constructor Detail

      • JavaQueryInMemoryEvaluator

        public JavaQueryInMemoryEvaluator​(String language,
                                          Query query,
                                          QueryCompilation compilation,
                                          Map parameterValues,
                                          ClassLoaderResolver clr,
                                          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 Collection evaluateSubquery​(Query subquery,
                                                       QueryCompilation compilation,
                                                       Collection candidates,
                                                       Object outerCandidate)
        Method to evaluate a subquery of the query being evaluated.
        Parameters:
        subquery - The subquery
        compilation - The subquery compilation
        candidates - The candidates for the subquery
        outerCandidate - The current outer candidate (for use when linking back to outer query)
        Returns:
        The result
      • execute

        public 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.