public class JPQLExpressionBuilder extends AbstractExpressionBuilder implements JPQLTreeConstants
JPQL and converts it to an expression tree using
an ExpressionFactory. Public for unit testing purposes.| Modifier and Type | Class and Description |
|---|---|
protected static class |
JPQLExpressionBuilder.JPQLNode
Base node that will be generated by the JPQLExpressionBuilder; base
class of the
SimpleNode that is used by JPQL. |
static class |
JPQLExpressionBuilder.ParsedJPQL
Public for unit testing purposes.
|
CONTAINS_TYPE_ELEMENT, CONTAINS_TYPE_KEY, CONTAINS_TYPE_VALUE, EX_FATAL, EX_UNSUPPORTED, EX_USER, factory, resolver, TYPE_CHAR_OBJ, TYPE_COLLECTION, TYPE_MAP, TYPE_NUMBER, TYPE_OBJECT, TYPE_STRINGJJTABS, JJTABSTRACTSCHEMANAME, JJTADD, JJTAGGREGATE, JJTALL, JJTAND, JJTANY, JJTASCENDING, JJTAVERAGE, JJTBETWEEN, JJTBOOLEANLITERAL, JJTCASE, JJTCLASSNAME, JJTCOALESCE, JJTCOLLECTIONPARAMETER, JJTCONCAT, JJTCONSTRUCTOR, JJTCONSTRUCTORPARAM, JJTCONSTRUCTORPARAMS, JJTCOUNT, JJTCURRENTDATE, JJTCURRENTTIME, JJTCURRENTTIMESTAMP, JJTDATELITERAL, JJTDECIMALLITERAL, JJTDELETE, JJTDESCENDING, JJTDISTINCT, JJTDISTINCTPATH, JJTDIVIDE, JJTENTRY, JJTEQUALS, JJTESCAPECHARACTER, JJTEXISTS, JJTFROM, JJTFROMITEM, JJTGENERALCASE, JJTGENERALIDENTIFIER, JJTGREATEROREQUAL, JJTGREATERTHAN, JJTGROUPBY, JJTGROUPBYEXTENSION, JJTHAVING, JJTIDENTIFICATIONVARIABLE, JJTIDENTIFIER, JJTIN, JJTINDEX, JJTINNERFETCHJOIN, JJTINNERJOIN, JJTINTEGERLITERAL, JJTISEMPTY, JJTISNULL, JJTKEY, JJTLENGTH, JJTLESSOREQUAL, JJTLESSTHAN, JJTLIKE, JJTLOCATE, JJTLOWER, JJTMAX, JJTMEMBEROF, JJTMIN, JJTMOD, JJTMULTIPLY, JJTNAMEDINPUTPARAMETER, JJTNEGATIVE, jjtNodeName, JJTNOT, JJTNOTEQUALS, JJTNULLIF, JJTOR, JJTORDERBY, JJTORDERBYEXTENSION, JJTORDERBYITEM, JJTOUTERFETCHJOIN, JJTOUTERJOIN, JJTPATH, JJTPATTERNVALUE, JJTPOSITIONALINPUTPARAMETER, JJTQUALIFIEDIDENTIFIER, JJTQUALIFIEDPATH, JJTSCALAREXPRESSION, JJTSELECT, JJTSELECTCLAUSE, JJTSELECTEXPRESSION, JJTSELECTEXPRESSIONS, JJTSELECTEXTENSION, JJTSIMPLECASE, JJTSIZE, JJTSQRT, JJTSTRINGLITERAL, JJTSTRINGLITERAL2, JJTSUBSELECT, JJTSUBSTRING, JJTSUBTRACT, JJTSUM, JJTTIMELITERAL, JJTTIMESTAMPLITERAL, JJTTOK, JJTTRIM, JJTTRIMBOTH, JJTTRIMCHARACTER, JJTTRIMLEADING, JJTTRIMTRAILING, JJTTYPE, JJTTYPELITERAL, JJTUPDATE, JJTUPDATEITEM, JJTUPDATEVALUE, JJTUPPER, JJTVALUE, JJTVOID, JJTWHEN, JJTWHENSCALAR, JJTWHERE| Constructor and Description |
|---|
JPQLExpressionBuilder(ExpressionFactory factory,
ExpressionStoreQuery query,
Object parsedQuery)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addSchemaToContext(String id,
ClassMetaData meta)
Register the schema alias to the current JPQL query context.
|
protected void |
addVariableToContext(String id,
Value var)
Register the variable associated with the schema alias (id) to
the current JPQL query context.
|
static void |
checkEmbeddable(Value val,
String currentQuery) |
static Value |
convertSubstringArguments(ExpressionFactory factory,
Value val1,
Value val2,
Value val3)
Converts JPQL substring() function to OpenJPA ExpressionFactory
substring() arguments.
|
protected String |
currentQuery()
Returns the current string being parsed; used for error messages.
|
protected Expression |
evalFetchJoins(QueryExpressions exps) |
protected void |
evalSetClause(QueryExpressions exps) |
protected ClassMetaData |
getCandidateMetaData(JPQLExpressionBuilder.JPQLNode node) |
protected ClassLoader |
getClassLoader()
Returns the class loader that should be used for resolving
class names (in addition to the resolver in the query).
|
protected Class<?> |
getDeclaredVariableType(String name)
Returns the type of the named variable if it has been declared.
|
protected Value |
getDefinedVariable(String id) |
protected Localizer |
getLocalizer()
Used for obtaining the
Localizer to use for translating
error messages. |
protected JPQLExpressionBuilder.ParsedJPQL |
getParsedQuery() |
protected JPQLExpressionBuilder.ParsedJPQL |
getParsedQuery(String jpql) |
protected Value |
getVariable(String var)
Returns the variable associated with the schema alias (id).
|
protected Value |
getVariable(String id,
boolean bind)
Identification variables in JPQL are case insensitive, so lower-case
all variables we are going to bind.
|
protected boolean |
isDeclaredVariable(String name)
Returns whether the specified variable name has been explicitly
declared.
|
protected boolean |
isSeenVariable(String var)
Return whether the given id has been used as a variable.
|
protected ClassMetaData |
resolveClassMetaData(JPQLExpressionBuilder.JPQLNode node) |
void |
setImplicitTypes(Value val1,
Value val2,
Class<?> expected)
Set the implicit types of the given values based on the fact that
they're used together, and based on the operator type.
|
static void |
setImplicitTypes(Value val1,
Value val2,
Class<?> expected,
Resolver resolver,
OrderedMap<Object,Class<?>> parameterTypes,
String currentQuery) |
addAccessPath, assertUnboundVariablesValid, bind, convertTypes, convertTypesQuotedNumbers, createVariable, getAccessPath, getMetaData, getMetaData, isBound, isNumeric, parseException, setImplicitContainsTypes, setImplicitType, setImplicitTypes, traversePath, traversePath, traverseStaticField, traverseXPathpublic JPQLExpressionBuilder(ExpressionFactory factory, ExpressionStoreQuery query, Object parsedQuery)
factory - the expression factory to usequery - used to resolve variables, parameters,
and class names used in the queryparsedQuery - the parsed queryprotected Localizer getLocalizer()
AbstractExpressionBuilderLocalizer to use for translating
error messages.getLocalizer in class AbstractExpressionBuilderprotected ClassLoader getClassLoader()
AbstractExpressionBuildergetClassLoader in class AbstractExpressionBuilderprotected JPQLExpressionBuilder.ParsedJPQL getParsedQuery()
protected JPQLExpressionBuilder.ParsedJPQL getParsedQuery(String jpql)
protected ClassMetaData resolveClassMetaData(JPQLExpressionBuilder.JPQLNode node)
protected ClassMetaData getCandidateMetaData(JPQLExpressionBuilder.JPQLNode node)
protected String currentQuery()
AbstractExpressionBuildercurrentQuery in class AbstractExpressionBuilderprotected Expression evalFetchJoins(QueryExpressions exps)
protected void evalSetClause(QueryExpressions exps)
protected boolean isDeclaredVariable(String name)
AbstractExpressionBuilderisDeclaredVariable in class AbstractExpressionBuildername - the variable to checkprotected Value getVariable(String id, boolean bind)
getVariable in class AbstractExpressionBuilderprotected boolean isSeenVariable(String var)
AbstractExpressionBuilderisSeenVariable in class AbstractExpressionBuilderpublic static Value convertSubstringArguments(ExpressionFactory factory, Value val1, Value val2, Value val3)
val1 - the original Stringval2 - the 1-based start index as per JPQL substring() semanticsval3 - the length of the returned string as per JPQL semanticspublic void setImplicitTypes(Value val1, Value val2, Class<?> expected)
AbstractExpressionBuildersetImplicitTypes in class AbstractExpressionBuilderpublic static void setImplicitTypes(Value val1, Value val2, Class<?> expected, Resolver resolver, OrderedMap<Object,Class<?>> parameterTypes, String currentQuery)
protected Class<?> getDeclaredVariableType(String name)
AbstractExpressionBuildergetDeclaredVariableType in class AbstractExpressionBuilderprotected void addSchemaToContext(String id, ClassMetaData meta)
AbstractExpressionBuilderaddSchemaToContext in class AbstractExpressionBuilderprotected void addVariableToContext(String id, Value var)
AbstractExpressionBuilderaddVariableToContext in class AbstractExpressionBuilderprotected Value getVariable(String var)
AbstractExpressionBuildergetVariable in class AbstractExpressionBuilderCopyright © 2006–2022 Apache Software Foundation. All rights reserved.