Package org.springframework.context.expression

# Class EnvironmentAccessor

java.lang.Object
org.springframework.context.expression.EnvironmentAccessor

All Implemented Interfaces:
  `org.springframework.expression.PropertyAccessor`, `org.springframework.expression.TargetedAccessor`

public class EnvironmentAccessor extends Object implements org.springframework.expression.PropertyAccessor
Read-only SpEL `PropertyAccessor` that knows how to retrieve properties of a Spring `Environment` instance.

Since:
  3.1
Author:
  Chris Beams

## Constructor Summary

Constructors
Constructor
Description
`EnvironmentAccessor()`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canRead(org.springframework.expression.EvaluationContext context, Object target, String name)`
`boolean`
`canWrite(org.springframework.expression.EvaluationContext context, Object target, String name)`
Read-only: returns `false`.
`Class<?>[]`
`getSpecificTargetClasses()`
`org.springframework.expression.TypedValue`
`read(org.springframework.expression.EvaluationContext context, Object target, String name)`
Access the given target object by resolving the given property name against the given target environment.
`void`
`write(org.springframework.expression.EvaluationContext context, Object target, String name, Object newValue)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### EnvironmentAccessor

public EnvironmentAccessor()

## Method Details

### getSpecificTargetClasses

public Class<?>[] getSpecificTargetClasses()

Specified by:
  `getSpecificTargetClasses` in interface `org.springframework.expression.TargetedAccessor`

### canRead

public boolean canRead(org.springframework.expression.EvaluationContext context, @Nullable Object target, String name) throws org.springframework.expression.AccessException

Specified by:
  `canRead` in interface `org.springframework.expression.PropertyAccessor`
Throws:
  `org.springframework.expression.AccessException`

### read

public org.springframework.expression.TypedValue read(org.springframework.expression.EvaluationContext context, @Nullable Object target, String name) throws org.springframework.expression.AccessException
Access the given target object by resolving the given property name against the given target environment.

Specified by:
  `read` in interface `org.springframework.expression.PropertyAccessor`
Throws:
  `org.springframework.expression.AccessException`

### canWrite

public boolean canWrite(org.springframework.expression.EvaluationContext context, @Nullable Object target, String name) throws org.springframework.expression.AccessException
Read-only: returns `false`.

Specified by:
  `canWrite` in interface `org.springframework.expression.PropertyAccessor`
Throws:
  `org.springframework.expression.AccessException`

### write

public void write(org.springframework.expression.EvaluationContext context, @Nullable Object target, String name, @Nullable Object newValue) throws org.springframework.expression.AccessException

Specified by:
  `write` in interface `org.springframework.expression.PropertyAccessor`
Throws:
  `org.springframework.expression.AccessException`