Top Description Constructors Methods
org.springframework.context.expression

public Class EnvironmentAccessor

extends Object
implements PropertyAccessor
Class Inheritance
All Implemented Interfaces
org.springframework.expression.PropertyAccessor
Imports
org.springframework.core.env.Environment, org.springframework.expression.AccessException, .EvaluationContext, .PropertyAccessor, .TypedValue, org.springframework.lang.Nullable, org.springframework.util.Assert

Read-only EL property accessor that knows how to retrieve keys of a Spring Environment instance.
Author
Chris Beams
Since
3.1

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true
canRead
(EvaluationContext
the evaluation context in which the access is being attempted
context
,
Object
the target object upon which the property is being accessed
target
,
String
the name of the property being accessed
name
)

Implements org.springframework.expression.PropertyAccessor.canRead.

Can read any Environment, thus always returns true.

public boolean
canWrite(EvaluationContext
the evaluation context in which the access is being attempted
context
,
Object
the target object upon which the property is being accessed
target
,
String
the name of the property being accessed
name
)

Implements org.springframework.expression.PropertyAccessor.canWrite.

Read-only: returns false.

public Class<?>[]
getSpecificTargetClasses()

Implements org.springframework.expression.PropertyAccessor.getSpecificTargetClasses.

Return an array of classes for which this resolver should be called.

public TypedValue
read(EvaluationContext
the evaluation context in which the access is being attempted
context
,
Object
the target object upon which the property is being accessed
target
,
String
the name of the property being accessed
name
)

Implements org.springframework.expression.PropertyAccessor.read.

Access the given target object by resolving the given property name against the given target environment.

public void
write(EvaluationContext
the evaluation context in which the access is being attempted
context
,
Object
the target object upon which the property is being accessed
target
,
String
the name of the property being accessed
name
,
Object
the new value for the property
newValue
)

Implements org.springframework.expression.PropertyAccessor.write.

Read-only: no-op.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EnvironmentAccessorback to summary
public EnvironmentAccessor()

Method Detail

canReadback to summary
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException

Implements org.springframework.expression.PropertyAccessor.canRead.

Can read any Environment, thus always returns true.

Parameters
context:EvaluationContext

Doc from org.springframework.expression.PropertyAccessor.canRead.

the evaluation context in which the access is being attempted

target:Object

Doc from org.springframework.expression.PropertyAccessor.canRead.

the target object upon which the property is being accessed

name:String

Doc from org.springframework.expression.PropertyAccessor.canRead.

the name of the property being accessed

Returns:boolean

true

Annotations
@Override
Exceptions
AccessException:

Doc from org.springframework.expression.PropertyAccessor.canRead.

if there is any problem determining whether the property can be read

canWriteback to summary
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException

Implements org.springframework.expression.PropertyAccessor.canWrite.

Read-only: returns false.

Parameters
context:EvaluationContext

Doc from org.springframework.expression.PropertyAccessor.canWrite.

the evaluation context in which the access is being attempted

target:Object

Doc from org.springframework.expression.PropertyAccessor.canWrite.

the target object upon which the property is being accessed

name:String

Doc from org.springframework.expression.PropertyAccessor.canWrite.

the name of the property being accessed

Returns:boolean

Doc from org.springframework.expression.PropertyAccessor.canWrite.

true if this resolver is able to write to the property

Annotations
@Override
Exceptions
AccessException:

Doc from org.springframework.expression.PropertyAccessor.canWrite.

if there is any problem determining whether the property can be written to

getSpecificTargetClassesback to summary
public Class<?>[] getSpecificTargetClasses()

Implements org.springframework.expression.PropertyAccessor.getSpecificTargetClasses.

Doc from org.springframework.expression.PropertyAccessor.getSpecificTargetClasses.

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.

Returns:Class<?>[]

an array of classes that this resolver is suitable for (or null if a general resolver)

Annotations
@Override
readback to summary
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException

Implements org.springframework.expression.PropertyAccessor.read.

Access the given target object by resolving the given property name against the given target environment.

Parameters
context:EvaluationContext

Doc from org.springframework.expression.PropertyAccessor.read.

the evaluation context in which the access is being attempted

target:Object

Doc from org.springframework.expression.PropertyAccessor.read.

the target object upon which the property is being accessed

name:String

Doc from org.springframework.expression.PropertyAccessor.read.

the name of the property being accessed

Returns:TypedValue

Doc from org.springframework.expression.PropertyAccessor.read.

a TypedValue object wrapping the property value read and a type descriptor for it

Annotations
@Override
Exceptions
AccessException:

Doc from org.springframework.expression.PropertyAccessor.read.

if there is any problem accessing the property value

writeback to summary
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException

Implements org.springframework.expression.PropertyAccessor.write.

Read-only: no-op.

Parameters
context:EvaluationContext

Doc from org.springframework.expression.PropertyAccessor.write.

the evaluation context in which the access is being attempted

target:Object

Doc from org.springframework.expression.PropertyAccessor.write.

the target object upon which the property is being accessed

name:String

Doc from org.springframework.expression.PropertyAccessor.write.

the name of the property being accessed

newValue:Object

Doc from org.springframework.expression.PropertyAccessor.write.

the new value for the property

Annotations
@Override
Exceptions
AccessException:

Doc from org.springframework.expression.PropertyAccessor.write.

if there is any problem writing to the property value