public final class SimpleEvaluationContext extends Object implements EvaluationContext
EvaluationContext that focuses on a subset
 of essential SpEL features and customization options, targeting simple
 condition evaluation and in particular data binding scenarios.
 In many cases, the full extent of the SpEL language is not required and
 should be meaningfully restricted. Examples include but are not limited to
 data binding expressions, property-based filters, and others. To that effect,
 SimpleEvaluationContext is tailored to support only a subset of the
 SpEL language syntax, e.g. excluding references to Java types, constructors,
 and bean references.
 
When creating a SimpleEvaluationContext you need to choose the
 level of support that you need for property access in SpEL expressions:
 
PropertyAccessor (typically not reflection-based),
 potentially combined with a DataBindingPropertyAccessorConveniently, forReadOnlyDataBinding()
 enables read access to properties via DataBindingPropertyAccessor;
 same for forReadWriteDataBinding() when
 write access is needed as well. Alternatively, configure custom accessors
 via forPropertyAccessors(org.springframework.expression.PropertyAccessor...), and potentially
 activate method resolution and/or a type converter through the builder.
 
Note that SimpleEvaluationContext is typically not configured
 with a default root object. Instead it is meant to be created once and
 used repeatedly through getValue calls on a pre-compiled
 Expression with both an
 EvaluationContext and a root object as arguments:
 Expression.getValue(EvaluationContext, Object).
 
For more power and flexibility, in particular for internal configuration
 scenarios, consider using StandardEvaluationContext instead.
forPropertyAccessors(org.springframework.expression.PropertyAccessor...), 
forReadOnlyDataBinding(), 
forReadWriteDataBinding(), 
StandardEvaluationContext, 
StandardTypeConverter, 
DataBindingPropertyAccessor| Modifier and Type | Class and Description | 
|---|---|
| static class  | SimpleEvaluationContext.BuilderBuilder for  SimpleEvaluationContext. | 
| Modifier and Type | Method and Description | 
|---|---|
| static SimpleEvaluationContext.Builder | forPropertyAccessors(PropertyAccessor... accessors)Create a  SimpleEvaluationContextfor the specifiedPropertyAccessordelegates: typically a customPropertyAccessorspecific to a use case
 (e.g. | 
| static SimpleEvaluationContext.Builder | forReadOnlyDataBinding()Create a  SimpleEvaluationContextfor read-only access to
 public properties viaDataBindingPropertyAccessor. | 
| static SimpleEvaluationContext.Builder | forReadWriteDataBinding()Create a  SimpleEvaluationContextfor read-write access to
 public properties viaDataBindingPropertyAccessor. | 
| BeanResolver | getBeanResolver()SimpleEvaluationContextdoes not support the use of bean references. | 
| List<ConstructorResolver> | getConstructorResolvers()Return an empty list, always, since this context does not support the
 use of type references. | 
| List<MethodResolver> | getMethodResolvers()Return the specified  MethodResolverdelegates, if any. | 
| OperatorOverloader | getOperatorOverloader()Return an instance of  StandardOperatorOverloader. | 
| List<PropertyAccessor> | getPropertyAccessors()Return the specified  PropertyAccessordelegates, if any. | 
| TypedValue | getRootObject()Return the specified root object, if any. | 
| TypeComparator | getTypeComparator()Return an instance of  StandardTypeComparator. | 
| TypeConverter | getTypeConverter()The configured  TypeConverter. | 
| TypeLocator | getTypeLocator()SimpleEvaluationContextdoes not support use of type references. | 
| Object | lookupVariable(String name)Look up a named variable within this evaluation context. | 
| void | setVariable(String name,
           Object value)Set a named variable within this evaluation context to a specified value. | 
public TypedValue getRootObject()
getRootObject in interface EvaluationContextpublic List<PropertyAccessor> getPropertyAccessors()
PropertyAccessor delegates, if any.getPropertyAccessors in interface EvaluationContextforPropertyAccessors(org.springframework.expression.PropertyAccessor...)public List<ConstructorResolver> getConstructorResolvers()
getConstructorResolvers in interface EvaluationContextpublic List<MethodResolver> getMethodResolvers()
MethodResolver delegates, if any.getMethodResolvers in interface EvaluationContextSimpleEvaluationContext.Builder.withMethodResolvers(org.springframework.expression.MethodResolver...)@Nullable public BeanResolver getBeanResolver()
SimpleEvaluationContext does not support the use of bean references.getBeanResolver in interface EvaluationContextnullpublic TypeLocator getTypeLocator()
SimpleEvaluationContext does not support use of type references.getTypeLocator in interface EvaluationContextTypeLocator implementation that raises a
 SpelEvaluationException with SpelMessage.TYPE_NOT_FOUND.public TypeConverter getTypeConverter()
TypeConverter.
 By default this is StandardTypeConverter.
public TypeComparator getTypeComparator()
StandardTypeComparator.getTypeComparator in interface EvaluationContextpublic OperatorOverloader getOperatorOverloader()
StandardOperatorOverloader.getOperatorOverloader in interface EvaluationContextpublic void setVariable(String name, @Nullable Object value)
EvaluationContextsetVariable in interface EvaluationContextname - variable to setvalue - value to be placed in the variable@Nullable public Object lookupVariable(String name)
EvaluationContextlookupVariable in interface EvaluationContextname - variable to lookupnull if not foundpublic static SimpleEvaluationContext.Builder forPropertyAccessors(PropertyAccessor... accessors)
SimpleEvaluationContext for the specified PropertyAccessor
 delegates: typically a custom PropertyAccessor specific to a use case
 (e.g. attribute resolution in a custom data structure), potentially combined with
 a DataBindingPropertyAccessor if property dereferences are needed as well.accessors - the accessor delegates to useDataBindingPropertyAccessor.forReadOnlyAccess(), 
DataBindingPropertyAccessor.forReadWriteAccess()public static SimpleEvaluationContext.Builder forReadOnlyDataBinding()
SimpleEvaluationContext for read-only access to
 public properties via DataBindingPropertyAccessor.public static SimpleEvaluationContext.Builder forReadWriteDataBinding()
SimpleEvaluationContext for read-write access to
 public properties via DataBindingPropertyAccessor.