de.odysseus.el.tree
Interface ExpressionNode

All Superinterfaces:
Node
All Known Implementing Classes:
AstBinary, AstBoolean, AstBracket, AstChoice, AstComposite, AstDot, AstEval, AstFunction, AstIdentifier, AstLiteral, AstMethod, AstNested, AstNode, AstNull, AstNumber, AstProperty, AstRightValue, AstString, AstText, AstUnary

public interface ExpressionNode
extends Node

Expression node interface. This interface provides all the methods needed for value expressions and method expressions.

Author:
Christoph Beck
See Also:
Tree

Method Summary
 MethodInfo getMethodInfo(Bindings bindings, ELContext context, java.lang.Class<?> returnType, java.lang.Class<?>[] paramTypes)
          Get method information.
 java.lang.String getStructuralId(Bindings bindings)
          Get the canonical expression string for this node.
 java.lang.Class<?> getType(Bindings bindings, ELContext context)
          Get the value type accepted in setValue(Bindings, ELContext, Object).
 java.lang.Object getValue(Bindings bindings, ELContext context, java.lang.Class<?> expectedType)
          Evaluate node.
 java.lang.Object invoke(Bindings bindings, ELContext context, java.lang.Class<?> returnType, java.lang.Class<?>[] paramTypes, java.lang.Object[] paramValues)
          Invoke method.
 boolean isLeftValue()
           
 boolean isLiteralText()
           
 boolean isReadOnly(Bindings bindings, ELContext context)
          Determine whether setValue(Bindings, ELContext, Object) will throw a PropertyNotWritableException.
 void setValue(Bindings bindings, ELContext context, java.lang.Object value)
          Assign value.
 
Methods inherited from interface de.odysseus.el.tree.Node
getCardinality, getChild
 

Method Detail

isLiteralText

boolean isLiteralText()
Returns:
true if this node represents literal text

isLeftValue

boolean isLeftValue()
Returns:
true if the subtree rooted at this node could be used as an lvalue expression (identifier or property sequence with non-literal proefix).

getValue

java.lang.Object getValue(Bindings bindings,
                          ELContext context,
                          java.lang.Class<?> expectedType)
Evaluate node.

Parameters:
bindings - bindings containing variables and functions
context - evaluation context
expectedType - result type
Returns:
evaluated node, coerced to the expected type

getType

java.lang.Class<?> getType(Bindings bindings,
                           ELContext context)
Get the value type accepted in setValue(Bindings, ELContext, Object).

Parameters:
bindings - bindings containing variables and functions
context - evaluation context
Returns:
accepted type or null for non-lvalue nodes

isReadOnly

boolean isReadOnly(Bindings bindings,
                   ELContext context)
Determine whether setValue(Bindings, ELContext, Object) will throw a PropertyNotWritableException.

Parameters:
bindings - bindings containing variables and functions
context - evaluation context
Returns:
true if this a read-only expression node

setValue

void setValue(Bindings bindings,
              ELContext context,
              java.lang.Object value)
Assign value.

Parameters:
bindings - bindings containing variables and functions
context - evaluation context
value - value to set

getMethodInfo

MethodInfo getMethodInfo(Bindings bindings,
                         ELContext context,
                         java.lang.Class<?> returnType,
                         java.lang.Class<?>[] paramTypes)
Get method information. If this is a non-lvalue node, answer null.

Parameters:
bindings - bindings containing variables and functions
context - evaluation context
returnType - expected method return type (may be null meaning don't care)
paramTypes - expected method argument types
Returns:
method information or null

invoke

java.lang.Object invoke(Bindings bindings,
                        ELContext context,
                        java.lang.Class<?> returnType,
                        java.lang.Class<?>[] paramTypes,
                        java.lang.Object[] paramValues)
Invoke method.

Parameters:
bindings - bindings containing variables and functions
context - evaluation context
returnType - expected method return type (may be null meaning don't care)
paramTypes - expected method argument types
paramValues - parameter values
Returns:
result of the method invocation

getStructuralId

java.lang.String getStructuralId(Bindings bindings)
Get the canonical expression string for this node. Variable and funtion names will be replaced in a way such that two expression nodes that have the same node structure and bindings will also answer the same value here.

For example, "${foo:bar()+2*foobar}" may lead to "${<fn>() + 2 * <var>}" if foobar is a bound variable. Otherwise, the structural id would be "${<fn>() + 2 * foobar}".

If the bindings is null, the full canonical subexpression is returned.


Copyright © 2006, 2007 Odysseus Software GmbH.