类 StandardEvaluationContext
- 所有已实现的接口:
EvaluationContext
EvaluationContext implementation.
This context uses standard implementations of all applicable strategies,
based on reflection to resolve properties, methods and fields.
For a simpler builder-style context variant for data-binding purposes,
consider using SimpleEvaluationContext instead which allows for
opting into several SpEL features as needed by specific evaluation cases.
- 从以下版本开始:
- 4.0
- 作者:
- Andy Clement, Juergen Hoeller, Sam Brannen, Harry Yang
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private BeanResolverprivate List<ConstructorResolver>private List<MethodResolver>private OperatorOverloaderprivate List<PropertyAccessor>private ReflectiveMethodResolverprivate TypedValueprivate TypeComparatorprivate TypeConverterprivate TypeLocator -
构造器概要
构造器构造器说明Create aStandardEvaluationContextwith a null root object.StandardEvaluationContext(Object rootObject) Create aStandardEvaluationContextwith the given root object. -
方法概要
修饰符和类型方法说明private static <T> voidaddBeforeDefault(List<T> resolvers, T resolver) voidaddConstructorResolver(ConstructorResolver resolver) voidaddMethodResolver(MethodResolver resolver) voidaddPropertyAccessor(PropertyAccessor accessor) Return a bean resolver that can look up beans by name.Return a list of resolvers that will be asked in turn to locate a constructor.Return a list of resolvers that will be asked in turn to locate a method.Return an operator overloader that may support mathematical operations between more than the standard set of types.Return a list of accessors that will be asked in turn to read/write a property.Return the default root context object against which unqualified properties/methods/etc should be resolved.Return a type comparator for comparing pairs of objects for equality.Return a type converter that can convert (or coerce) a value from one type to another.Get the configuredTypeLocatorthat will be used to find types, either by short or fully-qualified name.private List<ConstructorResolver>private List<MethodResolver>private List<PropertyAccessor>lookupVariable(String name) Look up a named variable within this evaluation context.voidregisterFunction(String name, MethodHandle methodHandle) Register the specified MethodHandle as a SpEL function.voidregisterFunction(String name, Method method) Register the specified Method as a SpEL function.voidregisterMethodFilter(Class<?> type, MethodFilter filter) Register aMethodFilterwhich will be called during method resolution for the specified type.booleanremoveConstructorResolver(ConstructorResolver resolver) booleanremoveMethodResolver(MethodResolver methodResolver) booleanremovePropertyAccessor(PropertyAccessor accessor) voidsetBeanResolver(BeanResolver beanResolver) voidsetConstructorResolvers(List<ConstructorResolver> constructorResolvers) voidsetMethodResolvers(List<MethodResolver> methodResolvers) voidsetOperatorOverloader(OperatorOverloader operatorOverloader) voidsetPropertyAccessors(List<PropertyAccessor> propertyAccessors) voidsetRootObject(Object rootObject) voidsetRootObject(Object rootObject, TypeDescriptor typeDescriptor) voidsetTypeComparator(TypeComparator typeComparator) voidsetTypeConverter(TypeConverter typeConverter) voidsetTypeLocator(TypeLocator typeLocator) Set theTypeLocatorto use to find types, either by short or fully-qualified name.voidsetVariable(String name, Object value) Set a named variable within this evaluation context to a specified value.voidsetVariables(Map<String, Object> variables) Set multiple named variables in this evaluation context to given values.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.expression.EvaluationContext
assignVariable
-
字段详细资料
-
rootObject
-
propertyAccessors
-
constructorResolvers
-
methodResolvers
-
reflectiveMethodResolver
-
beanResolver
-
typeLocator
-
typeConverter
-
typeComparator
-
operatorOverloader
-
variables
-
-
构造器详细资料
-
StandardEvaluationContext
public StandardEvaluationContext()Create aStandardEvaluationContextwith a null root object. -
StandardEvaluationContext
Create aStandardEvaluationContextwith the given root object.- 参数:
rootObject- the root object to use- 另请参阅:
-
-
方法详细资料
-
setRootObject
-
setRootObject
-
getRootObject
从接口复制的说明:EvaluationContextReturn the default root context object against which unqualified properties/methods/etc should be resolved. This can be overridden when evaluating an expression.- 指定者:
getRootObject在接口中EvaluationContext
-
setPropertyAccessors
-
getPropertyAccessors
从接口复制的说明:EvaluationContextReturn a list of accessors that will be asked in turn to read/write a property.- 指定者:
getPropertyAccessors在接口中EvaluationContext
-
addPropertyAccessor
-
removePropertyAccessor
-
setConstructorResolvers
-
getConstructorResolvers
从接口复制的说明:EvaluationContextReturn a list of resolvers that will be asked in turn to locate a constructor.- 指定者:
getConstructorResolvers在接口中EvaluationContext
-
addConstructorResolver
-
removeConstructorResolver
-
setMethodResolvers
-
getMethodResolvers
从接口复制的说明:EvaluationContextReturn a list of resolvers that will be asked in turn to locate a method.- 指定者:
getMethodResolvers在接口中EvaluationContext
-
addMethodResolver
-
removeMethodResolver
-
setBeanResolver
-
getBeanResolver
从接口复制的说明:EvaluationContextReturn a bean resolver that can look up beans by name.- 指定者:
getBeanResolver在接口中EvaluationContext
-
setTypeLocator
Set theTypeLocatorto use to find types, either by short or fully-qualified name.By default, a
StandardTypeLocatorwill be used.NOTE: Even if a
StandardTypeLocatoris sufficient, you may need to manually configure aStandardTypeLocatorwith a specificClassLoaderto ensure that the SpEL expression parser is able to reliably locate user types.- 参数:
typeLocator- theTypeLocatorto use- 另请参阅:
-
getTypeLocator
Get the configuredTypeLocatorthat will be used to find types, either by short or fully-qualified name.See
setTypeLocator(TypeLocator)for further details.- 指定者:
getTypeLocator在接口中EvaluationContext- 另请参阅:
-
setTypeConverter
-
getTypeConverter
从接口复制的说明:EvaluationContextReturn a type converter that can convert (or coerce) a value from one type to another.- 指定者:
getTypeConverter在接口中EvaluationContext
-
setTypeComparator
-
getTypeComparator
从接口复制的说明:EvaluationContextReturn a type comparator for comparing pairs of objects for equality.- 指定者:
getTypeComparator在接口中EvaluationContext
-
setOperatorOverloader
-
getOperatorOverloader
从接口复制的说明:EvaluationContextReturn an operator overloader that may support mathematical operations between more than the standard set of types.- 指定者:
getOperatorOverloader在接口中EvaluationContext
-
setVariable
从接口复制的说明:EvaluationContextSet a named variable within this evaluation context to a specified value.- 指定者:
setVariable在接口中EvaluationContext- 参数:
name- the name of the variable to setvalue- the value to be placed in the variable
-
setVariables
Set multiple named variables in this evaluation context to given values.This is a convenience variant of
setVariable(String, Object).- 参数:
variables- the names and values of the variables to set- 另请参阅:
-
registerFunction
Register the specified Method as a SpEL function.Note: Function names share a namespace with the variables in this evaluation context, as populated by
setVariable(String, Object). Make sure that specified function names and variable names do not overlap.- 参数:
name- the name of the functionmethod- the Method to register- 另请参阅:
-
registerFunction
Register the specified MethodHandle as a SpEL function.Note: Function names share a namespace with the variables in this evaluation context, as populated by
setVariable(String, Object). Make sure that specified function names and variable names do not overlap.- 参数:
name- the name of the functionmethodHandle- the MethodHandle to register- 另请参阅:
-
lookupVariable
从接口复制的说明:EvaluationContextLook up a named variable within this evaluation context.- 指定者:
lookupVariable在接口中EvaluationContext- 参数:
name- variable to lookup- 返回:
- the value of the variable, or
nullif not found
-
registerMethodFilter
Register aMethodFilterwhich will be called during method resolution for the specified type.The
MethodFiltermay remove methods and/or sort the methods which will then be used by SpEL as the candidates to look through for a match.- 参数:
type- the type for which the filter should be calledfilter- aMethodFilter, ornullto unregister a filter for the type- 抛出:
IllegalStateException- if theReflectiveMethodResolveris not in use
-
initPropertyAccessors
-
initConstructorResolvers
-
initMethodResolvers
-
addBeforeDefault
-