public abstract class JavaQueryCompiler extends Object implements SymbolResolver
Each "Expression" is effectively a tree of Expressions. You can navigate through each expression based on their type. For example, a DyadicExpression has a "left" and "right" and an operator between them. The left could also be a DyadicExpression, so you would navigate to its left/right components etc etc.
Modifier and Type | Field and Description |
---|---|
protected String |
candidateAlias
Alias for the primary candidate.
|
protected String |
candidateAliasOrig
Default candidate alias in use (only set when in a subquery and the same as the outer query).
|
protected Class |
candidateClass
Primary candidate class (if defined).
|
protected Collection |
candidates |
protected boolean |
caseSensitiveAliases |
protected ClassLoaderResolver |
clr |
protected String |
filter |
protected String |
from |
protected String |
grouping |
protected String |
having |
protected Imports |
imports |
static String |
JOIN_INNER |
static String |
JOIN_INNER_FETCH |
static String |
JOIN_OUTER |
static String |
JOIN_OUTER_FETCH |
static String |
JOIN_OUTER_FETCH_RIGHT |
static String |
JOIN_OUTER_RIGHT |
protected MetaDataManager |
metaDataManager |
protected Map<String,Object> |
options |
protected String |
ordering |
protected String |
parameters |
protected int |
parameterSubstitutionNumber |
protected Map<Object,String> |
parameterSubtitutionMap |
protected JavaQueryCompiler |
parentCompiler |
protected Parser |
parser
Parser specific to the type of query being compiled.
|
protected QueryManager |
queryMgr |
protected String |
result |
protected SymbolTable |
symtbl
Compiled Symbol Table.
|
protected String |
update |
protected String |
variables |
Constructor and Description |
---|
JavaQueryCompiler(PersistenceNucleusContext nucCtx,
ClassLoaderResolver clr,
String from,
Class candidateClass,
Collection candidates,
String filter,
Imports imports,
String ordering,
String result,
String grouping,
String having,
String params,
String variables,
String update) |
Modifier and Type | Method and Description |
---|---|
abstract QueryCompilation |
compile(Map parameters,
Map subqueryMap)
Method to compile the query.
|
void |
compileCandidatesParametersVariables(Map parameters)
Compile the candidates, variables and parameters.
|
Expression |
compileFilter()
Compile the filter and return the compiled expression.
|
protected Expression[] |
compileFrom()
Method to compile the "from" clause (if present for the query language).
|
Expression[] |
compileGrouping() |
Expression |
compileHaving() |
Expression[] |
compileOrdering() |
Expression[] |
compileResult() |
Expression[] |
compileUpdate() |
abstract String |
getLanguage()
Accessor for the query language name.
|
Class |
getPrimaryClass()
Accessor for the candidate class of the query.
|
Class |
getType(List<String> tuples) |
protected abstract boolean |
isKeyword(String name)
Method to return if the supplied name is a keyword.
|
Class |
resolveClass(String className)
Method to perform a lookup of the class name from the input name.
|
void |
setLinkToParentQuery(JavaQueryCompiler parentCompiler,
Map paramSubstitutionMap)
Method to set the linkage to the parent query.
|
void |
setOption(String name,
Object value) |
protected void |
swapCandidateAliasNodeName(Node node)
Convenience method that takes the input node and if it is set to the original candidate alias
then swaps the value to the candidate alias.
|
protected Node |
swapSubqueryParameters(Node node)
Convenience method that takes the input node if it is a parameter node and swaps the node
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
caseSensitiveSymbolNames, supportsImplicitVariables
public static final String JOIN_INNER
public static final String JOIN_INNER_FETCH
public static final String JOIN_OUTER
public static final String JOIN_OUTER_FETCH
public static final String JOIN_OUTER_RIGHT
public static final String JOIN_OUTER_FETCH_RIGHT
protected QueryManager queryMgr
protected JavaQueryCompiler parentCompiler
protected int parameterSubstitutionNumber
protected final MetaDataManager metaDataManager
protected final ClassLoaderResolver clr
protected boolean caseSensitiveAliases
protected Class candidateClass
protected String candidateAlias
protected String candidateAliasOrig
protected String from
protected Collection candidates
protected String update
protected String filter
protected String ordering
protected String parameters
protected String variables
protected String grouping
protected String having
protected String result
protected Imports imports
protected SymbolTable symtbl
protected Parser parser
public JavaQueryCompiler(PersistenceNucleusContext nucCtx, ClassLoaderResolver clr, String from, Class candidateClass, Collection candidates, String filter, Imports imports, String ordering, String result, String grouping, String having, String params, String variables, String update)
public abstract String getLanguage()
public void setLinkToParentQuery(JavaQueryCompiler parentCompiler, Map paramSubstitutionMap)
parentCompiler
- Compiler for the parent queryparamSubstitutionMap
- Map of parameters in this subquery and what they are
in the parent query.public abstract QueryCompilation compile(Map parameters, Map subqueryMap)
parameters
- The parameter values keyed by name.subqueryMap
- Map of subqueries keyed by the subquery namepublic void compileCandidatesParametersVariables(Map parameters)
parameters
- Map of parameter values keyed by their nameprotected Expression[] compileFrom()
public Expression[] compileUpdate()
public Expression compileFilter()
protected void swapCandidateAliasNodeName(Node node)
node
- The node to processprotected Node swapSubqueryParameters(Node node)
node
- The node to processpublic Expression[] compileResult()
public Expression[] compileGrouping()
public Expression compileHaving()
public Expression[] compileOrdering()
public Class getPrimaryClass()
SymbolResolver
getPrimaryClass
in interface SymbolResolver
public Class resolveClass(String className)
resolveClass
in interface SymbolResolver
className
- Name of the classClassNotResolvedException
- thrown if not resolvable using imports or entity namepublic Class getType(List<String> tuples)
getType
in interface SymbolResolver
protected abstract boolean isKeyword(String name)
name
- The nameCopyright © 2019. All rights reserved.