类 EnvironmentAccessor
- java.lang.Object
- org.springframework.context.expression.EnvironmentAccessor
- 所有已实现的接口:
PropertyAccessor
public class EnvironmentAccessor extends Object implements PropertyAccessor
Read-only EL property accessor that knows how to retrieve keys of a SpringEnvironment
instance.- 从以下版本开始:
- 3.1
- 作者:
- Chris Beams
构造器概要
构造器 构造器 说明 EnvironmentAccessor()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
canRead(EvaluationContext context, Object target, String name)
Can read anyEnvironment
, thus always returns true.boolean
canWrite(EvaluationContext context, Object target, String name)
Read-only: returnsfalse
.Class<?>[]
getSpecificTargetClasses()
Return an array of classes for which this resolver should be called.TypedValue
read(EvaluationContext context, Object target, String name)
Access the given target object by resolving the given property name against the given target environment.void
write(EvaluationContext context, Object target, String name, Object newValue)
Read-only: no-op.
构造器详细资料
EnvironmentAccessor
public EnvironmentAccessor()
方法详细资料
getSpecificTargetClasses
public Class<?>[] getSpecificTargetClasses()
从接口复制的说明:PropertyAccessor
Return an array of classes for which this resolver should be called.>Returning
null
indicates this is a general resolver that can be called in an attempt to resolve a property on any type.- 指定者:
getSpecificTargetClasses
在接口中PropertyAccessor
- 返回:
- an array of classes that this resolver is suitable for (or
null
if a general resolver)
canRead
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException
Can read anyEnvironment
, thus always returns true.- 指定者:
canRead
在接口中PropertyAccessor
- 参数:
context
- the evaluation context in which the access is being attemptedtarget
- the target object upon which the property is being accessedname
- the name of the property being accessed- 返回:
- true
- 抛出:
AccessException
- if there is any problem determining whether the property can be read
read
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException
Access the given target object by resolving the given property name against the given target environment.- 指定者:
read
在接口中PropertyAccessor
- 参数:
context
- the evaluation context in which the access is being attemptedtarget
- the target object upon which the property is being accessedname
- the name of the property being accessed- 返回:
- a TypedValue object wrapping the property value read and a type descriptor for it
- 抛出:
AccessException
- if there is any problem accessing the property value
canWrite
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException
Read-only: returnsfalse
.- 指定者:
canWrite
在接口中PropertyAccessor
- 参数:
context
- the evaluation context in which the access is being attemptedtarget
- the target object upon which the property is being accessedname
- the name of the property being accessed- 返回:
- true if this resolver is able to write to the property
- 抛出:
AccessException
- if there is any problem determining whether the property can be written to
write
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException
Read-only: no-op.- 指定者:
write
在接口中PropertyAccessor
- 参数:
context
- the evaluation context in which the access is being attemptedtarget
- the target object upon which the property is being accessedname
- the name of the property being accessednewValue
- the new value for the property- 抛出:
AccessException
- if there is any problem writing to the property value