ExpressionCompilerpublic interface OgnlExpressionCompiler
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
ROOT_TYPE |
Static constant used in conjunction with
OgnlContext to store temporary references. |
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.String |
castExpression(OgnlContext context,
Node expression,
java.lang.String body) |
Used primarily by AST types like
ASTChain where foo.bar.id type references
may need to be cast multiple times in order to properly resolve the members in a compiled statement. |
void |
compileExpression(OgnlContext context,
Node expression,
java.lang.Object root) |
The core method executed to compile a specific expression.
|
java.lang.String |
createLocalReference(OgnlContext context,
java.lang.String expression,
java.lang.Class type) |
Method is used for expressions where multiple inner parameter method calls in generated java source strings
cause javassit failures.
|
java.lang.String |
getClassName(java.lang.Class clazz) |
Gets a javassist safe class string for the given class instance.
|
java.lang.Class |
getInterfaceClass(java.lang.Class clazz) |
Used in places where the preferred
getSuperOrInterfaceClass(java.lang.reflect.Method, Class) isn't possible
because the method isn't known for a class. |
java.lang.Class |
getRootExpressionClass(Node rootNode,
OgnlContext context) |
For a given root object type returns the base class type to be used in root referenced expressions.
|
java.lang.Class |
getSuperOrInterfaceClass(java.lang.reflect.Method m,
java.lang.Class clazz) |
For the given
Method and class finds the highest level interface class this combination can be cast to. |
static final java.lang.String ROOT_TYPE
OgnlContext to store temporary references.void compileExpression(OgnlContext context, Node expression, java.lang.Object root) throws java.lang.Exception
Node with a non null Node.getAccessor() instance - unless an exception
is thrown by the method or the statement wasn't compilable in this instance because of missing/null objects
in the expression. These instances may in some cases continue to call this compilation method until the expression
is resolvable.context - The context of execution.expression - The pre-parsed root expression node to compile.root - The root object for the expression - may be null in many instances so some implementations
may exitjava.lang.Exception - If an error occurs compiling the expression and no strategy has been implemented to handle incremental
expression compilation for incomplete expression members.java.lang.String getClassName(java.lang.Class clazz)
clazz - The class to get a string equivalent javassist compatible string reference for.java.lang.Class getInterfaceClass(java.lang.Class clazz)
getSuperOrInterfaceClass(java.lang.reflect.Method, Class) isn't possible
because the method isn't known for a class. Attempts to upcast the given class to the next available non-private accessible
class so that compiled expressions can reference the interface class of an instance so as not to be compiled in to overly
specific statements.clazz - The class to attempt to find a compatible interface for.java.lang.Class getSuperOrInterfaceClass(java.lang.reflect.Method m,
java.lang.Class clazz)
Method and class finds the highest level interface class this combination can be cast to.m - The method the class must implement.clazz - The current class being worked with.Method is declared in.java.lang.Class getRootExpressionClass(Node rootNode, OgnlContext context)
rootNode - The root expression node.context - The current execution context.java.lang.String castExpression(OgnlContext context, Node expression, java.lang.String body)
ASTChain where foo.bar.id type references
may need to be cast multiple times in order to properly resolve the members in a compiled statement.
This method should be using the various OgnlContext.getCurrentType() / OgnlContext.getCurrentAccessor() methods
to inspect the type stack and properly cast to the right classes - but only when necessary.
context - The current execution context.expression - The node being checked for casting.body - The java source string generated by the given node.java.lang.String createLocalReference(OgnlContext context, java.lang.String expression, java.lang.Class type)
Takes an expression block generated by a node and creates a new method on the base object being compiled so that sufficiently complicated sub expression blocks can be broken out in to distinct methods to be referenced by the core accessor / setter methods in the base compiled root object.
context - The current execution context.expression - The java source expression to dump in to a seperate method reference.type - The return type that should be specified for the new method.