|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.el.Expression
javax.el.ValueExpression
de.odysseus.el.TreeValueExpression
public final class TreeValueExpression
A value expression is ready to be evaluated (by calling either
getType(ELContext)
, getValue(ELContext)
, isReadOnly(ELContext)
or setValue(ELContext, Object)
.
Instances of this class are usually created using an ExpressionFactoryImpl
.
Constructor Summary | |
---|---|
TreeValueExpression(TreeStore store,
FunctionMapper functions,
VariableMapper variables,
java.lang.String expr,
java.lang.Class<?> type)
Create a new value expression. |
Method Summary | |
---|---|
void |
dump(java.io.PrintWriter writer)
Print the parse tree. |
boolean |
equals(java.lang.Object obj)
Expressions are compared using the concept of a structural id: variable and function names are anonymized such that two expressions with same tree structure will also have the same structural id and vice versa. |
java.lang.Class<?> |
getExpectedType()
Returns the type the result of the expression will be coerced to after evaluation. |
java.lang.String |
getExpressionString()
Returns the original String used to create this Expression ,
unmodified. |
java.lang.Class<?> |
getType(ELContext context)
Evaluates the expression as an lvalue and answers the result type. |
java.lang.Object |
getValue(ELContext context)
Evaluates the expression as an rvalue and answers the result. |
int |
hashCode()
Returns the hash code for this Expression . |
boolean |
isDeferred()
Answer true if this is a deferred expression (containing
sub-expressions starting with #{ ) |
boolean |
isLeftValue()
Answer true if this could be used as an lvalue. |
boolean |
isLiteralText()
Returns whether this expression was created from only literal text. |
boolean |
isReadOnly(ELContext context)
Evaluates the expression as an lvalue and determines if setValue(ELContext, Object)
will always fail. |
void |
setValue(ELContext context,
java.lang.Object value)
Evaluates the expression as an lvalue and assigns the given value. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TreeValueExpression(TreeStore store, FunctionMapper functions, VariableMapper variables, java.lang.String expr, java.lang.Class<?> type)
store
- used to get the parse tree from.functions
- the function mapper used to bind functionsvariables
- the variable mapper used to bind variablesexpr
- the expression stringtype
- the expected type (may be null
)Method Detail |
---|
public java.lang.Class<?> getExpectedType()
ValueExpression
getExpectedType
in class ValueExpression
expectedType
passed to the
ExpressionFactory.createValueExpression
method
that created this ValueExpression
.public java.lang.String getExpressionString()
Expression
Expression
,
unmodified.
This is used for debugging purposes but also for the purposes of comparison (e.g. to ensure the expression in a configuration file has not changed).
This method does not provide sufficient information to
re-create an expression. Two different expressions can have exactly
the same expression string but different function mappings.
Serialization should be used to save and restore the state of an
Expression
.
getExpressionString
in class Expression
public java.lang.Class<?> getType(ELContext context) throws ELException
getType
in class ValueExpression
context
- used to resolve properties (base.property
and base[property]
)
and to determine the result from the last base/property pair
null
for rvalue expressions
ELException
- if evaluation fails (e.g. property not found, type conversion failed, ...)public java.lang.Object getValue(ELContext context) throws ELException
getValue
in class ValueExpression
context
- used to resolve properties (base.property
and base[property]
)
and to determine the result from the last base/property pair
ELException
- if evaluation fails (e.g. property not found, type conversion failed, ...)public boolean isReadOnly(ELContext context) throws ELException
setValue(ELContext, Object)
will always fail.
isReadOnly
in class ValueExpression
context
- used to resolve properties (base.property
and base[property]
)
and to determine the result from the last base/property pair
true
if setValue(ELContext, Object)
always fails.
ELException
- if evaluation fails (e.g. property not found, type conversion failed, ...)public void setValue(ELContext context, java.lang.Object value) throws ELException
setValue
in class ValueExpression
context
- used to resolve properties (base.property
and base[property]
)
and to perform the assignment to the last base/property pairvalue
- The new value to be set.
ELException
- if evaluation fails (e.g. property not found, type conversion failed, assignment failed...)public boolean isLiteralText()
Expression
This method must return true
if and only if the
expression string this expression was created from contained no
unescaped EL delimeters (${...}
or
#{...}
).
isLiteralText
in class Expression
true
if this is a literal text expressionpublic boolean isLeftValue()
true
if this could be used as an lvalue.
This is the case for eval expressions consisting of a simple identifier or
a nonliteral prefix, followed by a sequence of property operators (.
or []
)
public boolean isDeferred()
true
if this is a deferred expression (containing
sub-expressions starting with #{
)
public boolean equals(java.lang.Object obj)
equals
in class Expression
obj
- the Object
to test for equality.
true
if obj
equals this
Expression
; false
otherwise.Hashtable
,
Object.equals(java.lang.Object)
public int hashCode()
Expression
Expression
.
See the note in the Expression.equals(java.lang.Object)
method on how two expressions
can be equal if their expression Strings are different. Recall that
if two objects are equal according to the equals(Object)
method, then calling the hashCode
method on each of the
two objects must produce the same integer result. Implementations must
take special note and implement hashCode
correctly.
hashCode
in class Expression
Expression
.Expression.equals(java.lang.Object)
,
Hashtable
,
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
public void dump(java.io.PrintWriter writer)
writer
-
|
Copyright © 2006, 2007 Odysseus Software GmbH. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |