Top Description Methods
org.springframework.expression

public Interface EvaluationContext

Known Direct Implementers
org.springframework.expression.spel.support.SimpleEvaluationContext, org.springframework.expression.spel.support.StandardEvaluationContext
Imports
java.util.List, java.util.function.Supplier, org.springframework.lang.Nullable

Expressions are executed in an evaluation context. It is in this context that references are resolved when encountered during expression evaluation.

There are two default implementations of this interface.

Authors
Andy Clement, Juergen Hoeller, Sam Brannen
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public default TypedValue

Returns:

a TypedValue wrapping the assigned value
assignVariable
(String
the name of the variable to assign
name
,
Supplier<TypedValue>
the supplier of the value to be assigned to the variable
valueSupplier
)

Assign the value created by the specified Supplier to a named variable within this evaluation context.

public BeanResolver
getBeanResolver()

Return a bean resolver that can look up beans by name.

public List<ConstructorResolver>
getConstructorResolvers()

Return a list of resolvers that will be asked in turn to locate a constructor.

public List<MethodResolver>
getMethodResolvers()

Return a list of resolvers that will be asked in turn to locate a method.

public OperatorOverloader
getOperatorOverloader()

Return an operator overloader that may support mathematical operations between more than the standard set of types.

public List<PropertyAccessor>
getPropertyAccessors()

Return a list of accessors that will be asked in turn to read/write a property.

public TypedValue
getRootObject()

Return the default root context object against which unqualified properties/methods/etc should be resolved.

public TypeComparator
getTypeComparator()

Return a type comparator for comparing pairs of objects for equality.

public TypeConverter
getTypeConverter()

Return a type converter that can convert (or coerce) a value from one type to another.

public TypeLocator
getTypeLocator()

Return a type locator that can be used to find types, either by short or fully qualified name.

public Object

Returns:

the value of the variable, or null if not found
lookupVariable
(String
the name of the variable to look up
name
)

Look up a named variable within this evaluation context.

public void
setVariable(String
the name of the variable to set
name
,
Object
the value to be placed in the variable
value
)

Set a named variable in this evaluation context to a specified value.

Method Detail

assignVariableback to summary
public default TypedValue assignVariable(String name, Supplier<TypedValue> valueSupplier)

Assign the value created by the specified Supplier to a named variable within this evaluation context.

In contrast to setVariable(String, Object), this method should only be invoked to support the assignment operator (=) within an expression.

By default, this method delegates to setVariable(String, Object), providing the value created by the valueSupplier. Concrete implementations may override this default method to provide different semantics.

Parameters
name:String

the name of the variable to assign

valueSupplier:Supplier<TypedValue>

the supplier of the value to be assigned to the variable

Returns:TypedValue

a TypedValue wrapping the assigned value

Since
5.2.24
getBeanResolverback to summary
public BeanResolver getBeanResolver()

Return a bean resolver that can look up beans by name.

Annotations
@Nullable
getConstructorResolversback to summary
public List<ConstructorResolver> getConstructorResolvers()

Return a list of resolvers that will be asked in turn to locate a constructor.

getMethodResolversback to summary
public List<MethodResolver> getMethodResolvers()

Return a list of resolvers that will be asked in turn to locate a method.

getOperatorOverloaderback to summary
public OperatorOverloader getOperatorOverloader()

Return an operator overloader that may support mathematical operations between more than the standard set of types.

getPropertyAccessorsback to summary
public List<PropertyAccessor> getPropertyAccessors()

Return a list of accessors that will be asked in turn to read/write a property.

getRootObjectback to summary
public TypedValue getRootObject()

Return the default root context object against which unqualified properties/methods/etc should be resolved. This can be overridden when evaluating an expression.

getTypeComparatorback to summary
public TypeComparator getTypeComparator()

Return a type comparator for comparing pairs of objects for equality.

getTypeConverterback to summary
public TypeConverter getTypeConverter()

Return a type converter that can convert (or coerce) a value from one type to another.

getTypeLocatorback to summary
public TypeLocator getTypeLocator()

Return a type locator that can be used to find types, either by short or fully qualified name.

lookupVariableback to summary
public Object lookupVariable(String name)

Look up a named variable within this evaluation context.

Parameters
name:String

the name of the variable to look up

Returns:Object

the value of the variable, or null if not found

Annotations
@Nullable
setVariableback to summary
public void setVariable(String name, Object value)

Set a named variable in this evaluation context to a specified value.

In contrast to assignVariable(String, Supplier), this method should only be invoked programmatically when interacting directly with the EvaluationContext — for example, to provide initial configuration for the context.

Parameters
name:String

the name of the variable to set

value:Object

the value to be placed in the variable

See Also
lookupVariable(String)