public abstract class AbstractExpressionBuilder extends Object
Modifier and Type | Field and Description |
---|---|
static int |
CONTAINS_TYPE_ELEMENT |
static int |
CONTAINS_TYPE_KEY |
static int |
CONTAINS_TYPE_VALUE |
protected static int |
EX_FATAL |
protected static int |
EX_UNSUPPORTED |
protected static int |
EX_USER |
protected ExpressionFactory |
factory |
protected Resolver |
resolver |
static Class<Character> |
TYPE_CHAR_OBJ |
static Class<Collection> |
TYPE_COLLECTION |
static Class<Map> |
TYPE_MAP |
static Class<Number> |
TYPE_NUMBER |
static Class<Object> |
TYPE_OBJECT |
static Class<String> |
TYPE_STRING |
Constructor and Description |
---|
AbstractExpressionBuilder(ExpressionFactory factory,
Resolver resolver)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected ClassMetaData |
addAccessPath(ClassMetaData meta)
Register the specified metadata as being in the query's access path.
|
protected abstract void |
addSchemaToContext(String alias,
ClassMetaData meta)
Register the schema alias to the current JPQL query context.
|
protected abstract void |
addVariableToContext(String id,
Value var)
Register the variable associated with the schema alias (id) to
the current JPQL query context.
|
protected void |
assertUnboundVariablesValid()
Validate that all unbound variables are of a PC type.
|
protected void |
bind(Value var)
Record that the given variable is bound.
|
static void |
convertTypes(Value val1,
Value val2)
Perform conversions to make values compatible.
|
static void |
convertTypesQuotedNumbers(Value val1,
Value val2)
Perform conversions to make values compatible.
|
protected Value |
createVariable(String id,
boolean bind) |
protected abstract String |
currentQuery()
Returns the current string being parsed; used for error messages.
|
protected ClassMetaData[] |
getAccessPath()
Return the recorded query access path.
|
protected abstract ClassLoader |
getClassLoader()
Returns the class loader that should be used for resolving
class names (in addition to the resolver in the query).
|
protected abstract Class<?> |
getDeclaredVariableType(String name)
Returns the type of the named variable if it has been declared.
|
protected abstract Localizer |
getLocalizer()
Used for obtaining the
Localizer to use for translating
error messages. |
protected ClassMetaData |
getMetaData(Class<?> c,
boolean required)
Convenience method to get metadata for the given type.
|
protected ClassMetaData |
getMetaData(Class<?> c,
boolean required,
ClassLoader loader)
Convenience method to get metadata for the given type.
|
protected abstract Value |
getVariable(String id)
Returns the variable associated with the schema alias (id).
|
protected Value |
getVariable(String id,
boolean bind)
Returns a value for the given id.
|
protected boolean |
isBound(Value var)
Return true if the given variable has been bound.
|
protected abstract boolean |
isDeclaredVariable(String id)
Returns whether the specified variable name has been explicitly
declared.
|
static boolean |
isNumeric(Class<?> type)
Return true if given class can be used as a number.
|
protected boolean |
isSeenVariable(String id)
Return whether the given id has been used as a variable.
|
protected OpenJPAException |
parseException(int e,
String token,
Object[] args,
Exception nest)
Create a proper parse exception for the given reason.
|
protected void |
setImplicitContainsTypes(Value val1,
Value val2,
int op)
Set the implicit types of the given values based on the fact that
the first is supposed to contain the second.
|
protected static void |
setImplicitType(Value val,
Class<?> expected)
Set the implicit type of the given value to the given class.
|
protected 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.
|
protected static void |
setImplicitTypes(Value val1,
Value val2,
Class<?> expected,
Resolver resolver) |
protected Value |
traversePath(Path path,
String field)
Traverse the given field in the given path.
|
protected Value |
traversePath(Path path,
String field,
boolean pcOnly,
boolean allowNull)
Traverse the given field in the given path.
|
protected Object |
traverseStaticField(Class<?> cls,
String field)
Return a constant containing the value of the given static field.
|
protected Value |
traverseXPath(Path path,
String field) |
protected static final int EX_USER
protected static final int EX_FATAL
protected static final int EX_UNSUPPORTED
public static final Class<Collection> TYPE_COLLECTION
public static final int CONTAINS_TYPE_ELEMENT
public static final int CONTAINS_TYPE_KEY
public static final int CONTAINS_TYPE_VALUE
protected final Resolver resolver
protected ExpressionFactory factory
public AbstractExpressionBuilder(ExpressionFactory factory, Resolver resolver)
factory
- the expression factory to useresolver
- used to resolve variables, parameters, and class
names used in the queryprotected abstract ClassLoader getClassLoader()
protected OpenJPAException parseException(int e, String token, Object[] args, Exception nest)
protected ClassMetaData addAccessPath(ClassMetaData meta)
protected ClassMetaData[] getAccessPath()
protected boolean isBound(Value var)
protected void bind(Value var)
protected void assertUnboundVariablesValid()
protected abstract boolean isDeclaredVariable(String id)
id
- the variable to checkprotected boolean isSeenVariable(String id)
protected ClassMetaData getMetaData(Class<?> c, boolean required)
protected ClassMetaData getMetaData(Class<?> c, boolean required, ClassLoader loader)
protected Value traversePath(Path path, String field)
protected Value traversePath(Path path, String field, boolean pcOnly, boolean allowNull)
protected Object traverseStaticField(Class<?> cls, String field)
protected abstract Class<?> getDeclaredVariableType(String name)
protected void setImplicitTypes(Value val1, Value val2, Class<?> expected)
protected static void setImplicitTypes(Value val1, Value val2, Class<?> expected, Resolver resolver)
public static void convertTypes(Value val1, Value val2)
public static void convertTypesQuotedNumbers(Value val1, Value val2)
public static boolean isNumeric(Class<?> type)
protected void setImplicitContainsTypes(Value val1, Value val2, int op)
protected static void setImplicitType(Value val, Class<?> expected)
protected abstract Localizer getLocalizer()
Localizer
to use for translating
error messages.protected abstract String currentQuery()
protected abstract void addSchemaToContext(String alias, ClassMetaData meta)
protected abstract void addVariableToContext(String id, Value var)
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.