Package de.odysseus.el
Class TreeValueExpression
java.lang.Object
javax.el.Expression
javax.el.ValueExpression
de.odysseus.el.TreeValueExpression
- All Implemented Interfaces:
Serializable
public final class TreeValueExpression
extends javax.el.ValueExpression
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
.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Bindings
private final TreeBuilder
private final boolean
private final String
private ExpressionNode
private static final long
private String
private final Class
<?> -
Constructor Summary
ConstructorsConstructorDescriptionTreeValueExpression
(TreeStore store, javax.el.FunctionMapper functions, javax.el.VariableMapper variables, TypeConverter converter, String expr, Class<?> type) Create a new value expression. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump
(PrintWriter writer) Print the parse tree.boolean
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.Class
<?> private String
Class
<?> getType
(javax.el.ELContext context) Evaluates the expression as an lvalue and answers the result type.getValue
(javax.el.ELContext context) Evaluates the expression as an rvalue and answers the result.javax.el.ValueReference
getValueReference
(javax.el.ELContext context) int
hashCode()
boolean
Answertrue
if this is a deferred expression (containing sub-expressions starting with#{
)boolean
Answertrue
if this could be used as an lvalue.boolean
boolean
isReadOnly
(javax.el.ELContext context) Evaluates the expression as an lvalue and determines ifsetValue(ELContext, Object)
will always fail.private void
void
Evaluates the expression as an lvalue and assigns the given value.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
builder
-
bindings
-
expr
-
type
-
deferred
private final boolean deferred -
node
-
structure
-
-
Constructor Details
-
TreeValueExpression
public TreeValueExpression(TreeStore store, javax.el.FunctionMapper functions, javax.el.VariableMapper variables, TypeConverter converter, String expr, Class<?> type) Create a new value expression.- Parameters:
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 benull
)
-
-
Method Details
-
getStructuralId
-
getExpectedType
- Specified by:
getExpectedType
in classjavax.el.ValueExpression
-
getExpressionString
- Specified by:
getExpressionString
in classjavax.el.Expression
-
getType
Evaluates the expression as an lvalue and answers the result type.- Specified by:
getType
in classjavax.el.ValueExpression
- Parameters:
context
- used to resolve properties (base.property
andbase[property]
) and to determine the result from the last base/property pair- Returns:
- lvalue evaluation type or
null
for rvalue expressions - Throws:
javax.el.ELException
- if evaluation fails (e.g. property not found, type conversion failed, ...)
-
getValue
Evaluates the expression as an rvalue and answers the result.- Specified by:
getValue
in classjavax.el.ValueExpression
- Parameters:
context
- used to resolve properties (base.property
andbase[property]
) and to determine the result from the last base/property pair- Returns:
- rvalue evaluation result
- Throws:
javax.el.ELException
- if evaluation fails (e.g. property not found, type conversion failed, ...)
-
isReadOnly
public boolean isReadOnly(javax.el.ELContext context) throws javax.el.ELException Evaluates the expression as an lvalue and determines ifsetValue(ELContext, Object)
will always fail.- Specified by:
isReadOnly
in classjavax.el.ValueExpression
- Parameters:
context
- used to resolve properties (base.property
andbase[property]
) and to determine the result from the last base/property pair- Returns:
true
ifsetValue(ELContext, Object)
always fails.- Throws:
javax.el.ELException
- if evaluation fails (e.g. property not found, type conversion failed, ...)
-
setValue
Evaluates the expression as an lvalue and assigns the given value.- Specified by:
setValue
in classjavax.el.ValueExpression
- Parameters:
context
- used to resolve properties (base.property
andbase[property]
) and to perform the assignment to the last base/property pair- Throws:
javax.el.ELException
- if evaluation fails (e.g. property not found, type conversion failed, assignment failed...)
-
isLiteralText
public boolean isLiteralText()- Specified by:
isLiteralText
in classjavax.el.Expression
- Returns:
true
if this is a literal text expression
-
getValueReference
public javax.el.ValueReference getValueReference(javax.el.ELContext context) - Overrides:
getValueReference
in classjavax.el.ValueExpression
-
isLeftValue
public boolean isLeftValue()Answertrue
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[]
) -
isDeferred
public boolean isDeferred()Answertrue
if this is a deferred expression (containing sub-expressions starting with#{
) -
equals
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. Two value expressions are equal if- their structural id's are equal
- their bindings are equal
- their expected types are equal
- Specified by:
equals
in classjavax.el.Expression
-
hashCode
public int hashCode()- Specified by:
hashCode
in classjavax.el.Expression
-
toString
-
dump
Print the parse tree.- Parameters:
writer
-
-
readObject
- Throws:
IOException
ClassNotFoundException
-