public interface OgnlExpressionCompiler
Modifier and Type | Field and Description |
---|---|
static String |
ROOT_TYPE
Static constant used in conjunction with
OgnlContext to store temporary references. |
Modifier and Type | Method and Description |
---|---|
String |
castExpression(OgnlContext context,
Node expression,
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,
Object root)
The core method executed to compile a specific expression.
|
String |
createLocalReference(OgnlContext context,
String expression,
Class type)
Method is used for expressions where multiple inner parameter method calls in generated java source strings
cause javassit failures.
|
String |
getClassName(Class clazz)
Gets a javassist safe class string for the given class instance.
|
Class |
getInterfaceClass(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. |
Class |
getRootExpressionClass(Node rootNode,
OgnlContext context)
For a given root object type returns the base class type to be used in root referenced expressions.
|
Class |
getSuperOrInterfaceClass(Method m,
Class clazz)
For the given
Method and class finds the highest level interface class this combination can be cast to. |
static final String ROOT_TYPE
OgnlContext
to store temporary references.void compileExpression(OgnlContext context, Node expression, Object root) throws 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 exitException
- If an error occurs compiling the expression and no strategy has been implemented to handle incremental
expression compilation for incomplete expression members.String getClassName(Class clazz)
clazz
- The class to get a string equivalent javassist compatible string reference for.Class getInterfaceClass(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.Class getSuperOrInterfaceClass(Method m, 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.Class getRootExpressionClass(Node rootNode, OgnlContext context)
rootNode
- The root expression node.context
- The current execution context.String castExpression(OgnlContext context, Node expression, 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.String createLocalReference(OgnlContext context, String expression, 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.Copyright © 1997–2021 The Apache Software Foundation. All rights reserved.