Class ExpressionState
java.lang.Object
org.springframework.expression.spel.ExpressionState
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 to define common utility routines that the various AST nodes might need.
- Since:
- 3.0
- Author:
- Andy Clement, Juergen Hoeller, Sam Brannen
- 
Constructor SummaryConstructorsConstructorDescriptionExpressionState(EvaluationContext context) ExpressionState(EvaluationContext context, SpelParserConfiguration configuration) ExpressionState(EvaluationContext context, TypedValue rootObject) ExpressionState(EvaluationContext context, TypedValue rootObject, SpelParserConfiguration configuration) 
- 
Method SummaryModifier and TypeMethodDescriptionassignVariable(String name, Supplier<TypedValue> valueSupplier) Assign the value created by the specifiedSupplierto a named variable within the evaluation context.convertValue(Object value, TypeDescriptor targetTypeDescriptor) convertValue(TypedValue value, TypeDescriptor targetTypeDescriptor) voidEnter a new scope with a new root context object and a new local variable scope.voidClass<?> The active context object is what unqualified references to properties/etc are resolved against.lookupVariable(String name) Look up a named global variable in the evaluation context.voidvoidvoidsetVariable(String name, @Nullable Object value) Set a named variable in the evaluation context to a specified value.
- 
Constructor Details- 
ExpressionState
- 
ExpressionState
- 
ExpressionState
- 
ExpressionStatepublic ExpressionState(EvaluationContext context, TypedValue rootObject, SpelParserConfiguration configuration) 
 
- 
- 
Method Details- 
getActiveContextObjectThe active context object is what unqualified references to properties/etc are resolved against.
- 
pushActiveContextObject
- 
popActiveContextObjectpublic void popActiveContextObject()
- 
getRootContextObject
- 
getScopeRootContextObject
- 
assignVariableAssign the value created by the specifiedSupplierto a named variable within the evaluation context.In contrast to setVariable(String, Object), this method should only be invoked to support assignment within an expression.- Parameters:
- name- the name of the variable to assign
- valueSupplier- the supplier of the value to be assigned to the variable
- Returns:
- a TypedValuewrapping the assigned value
- Since:
- 5.2.24
- See Also:
 
- 
setVariableSet a named variable in the evaluation context to a specified value.In contrast to assignVariable(String, Supplier), this method should only be invoked programmatically.- Parameters:
- name- the name of the variable to set
- value- the value to be placed in the variable
- See Also:
 
- 
lookupVariableLook up a named global variable in the evaluation context.- Parameters:
- name- the name of the variable to look up
- Returns:
- a TypedValuecontaining the value of the variable, orTypedValue.NULLif the variable does not exist
- See Also:
 
- 
getTypeComparator
- 
findType- Throws:
- EvaluationException
 
- 
getTypeConverter
- 
convertValuepublic Object convertValue(Object value, TypeDescriptor targetTypeDescriptor) throws EvaluationException - Throws:
- EvaluationException
 
- 
convertValuepublic @Nullable Object convertValue(TypedValue value, TypeDescriptor targetTypeDescriptor) throws EvaluationException - Throws:
- EvaluationException
 
- 
enterScopepublic void enterScope()Enter a new scope with a new root context object and a new local variable scope.
- 
exitScopepublic void exitScope()
- 
operatepublic TypedValue operate(Operation op, @Nullable Object left, @Nullable Object right) throws EvaluationException - Throws:
- EvaluationException
 
- 
getPropertyAccessors
- 
getEvaluationContext
- 
getConfiguration
 
-