org.springframework.expression.spel
Class ExpressionState
java.lang.Object
org.springframework.expression.spel.ExpressionState
public class ExpressionState
- extends java.lang.Object
An ExpressionState is for maintaining per-expression-evaluation state, any changes to it are not seen by other
expressions but it gives a place to hold local variables and for component expressions in a compound expression to
communicate state. This is in contrast to the EvaluationContext, which is shared amongst expression evaluations, and
any changes to it will be seen by other expressions or any code that chooses to ask questions of the context.
It also acts as a place for to define common utility routines that the various Ast nodes might need.
- Since:
- 3.0
- Author:
- Andy Clement
Nested Class Summary |
private static class |
ExpressionState.VariableScope
A new scope is entered when a function is called and it is used to hold the parameters to the function call. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
relatedContext
private final EvaluationContext relatedContext
variableScopes
private java.util.Stack<ExpressionState.VariableScope> variableScopes
contextObjects
private java.util.Stack<TypedValue> contextObjects
rootObject
private final TypedValue rootObject
configuration
private SpelParserConfiguration configuration
ExpressionState
public ExpressionState(EvaluationContext context)
ExpressionState
public ExpressionState(EvaluationContext context,
SpelParserConfiguration configuration)
ExpressionState
public ExpressionState(EvaluationContext context,
TypedValue rootObject)
ExpressionState
public ExpressionState(EvaluationContext context,
TypedValue rootObject,
SpelParserConfiguration configuration)
ensureVariableScopesInitialized
private void ensureVariableScopesInitialized()
getActiveContextObject
public TypedValue getActiveContextObject()
- The active context object is what unqualified references to properties/etc are resolved against.
pushActiveContextObject
public void pushActiveContextObject(TypedValue obj)
popActiveContextObject
public void popActiveContextObject()
getRootContextObject
public TypedValue getRootContextObject()
setVariable
public void setVariable(java.lang.String name,
java.lang.Object value)
lookupVariable
public TypedValue lookupVariable(java.lang.String name)
getTypeComparator
public TypeComparator getTypeComparator()
findType
public java.lang.Class<?> findType(java.lang.String type)
throws EvaluationException
- Throws:
EvaluationException
convertValue
public java.lang.Object convertValue(java.lang.Object value,
TypeDescriptor targetTypeDescriptor)
throws EvaluationException
- Throws:
EvaluationException
convertValue
public java.lang.Object convertValue(TypedValue value,
TypeDescriptor targetTypeDescriptor)
throws EvaluationException
- Throws:
EvaluationException
enterScope
public void enterScope(java.util.Map<java.lang.String,java.lang.Object> argMap)
enterScope
public void enterScope(java.lang.String name,
java.lang.Object value)
exitScope
public void exitScope()
setLocalVariable
public void setLocalVariable(java.lang.String name,
java.lang.Object value)
lookupLocalVariable
public java.lang.Object lookupLocalVariable(java.lang.String name)
operate
public TypedValue operate(Operation op,
java.lang.Object left,
java.lang.Object right)
throws EvaluationException
- Throws:
EvaluationException
getPropertyAccessors
public java.util.List<PropertyAccessor> getPropertyAccessors()
getEvaluationContext
public EvaluationContext getEvaluationContext()
getConfiguration
public SpelParserConfiguration getConfiguration()