BeanFactoryAccessor class final
A PropertyAccessor that reads beans as properties of a BeanFactory
itself, for expressions whose value is a bean factory
(factory.mailer).
StandardBeanExpressionResolver registers it for @Value
expressions. Beans cannot be assigned through it: writing throws an
AccessException.
// The bean factory is the root: `mailer` is a bean.
final context = StandardEvaluationContext(beanFactory)
..addPropertyAccessor(const BeanFactoryAccessor());
SpelExpressionParser().parseExpression('mailer').getValue(context);
Spring (Java):
context.addPropertyAccessor(new BeanFactoryAccessor());
parser.parseExpression("mailer").getValue(context);
- Implemented types
Constructors
- BeanFactoryAccessor()
-
Creates the accessor (stateless).
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
canRead(
EvaluationContext context, Object target, String name) → bool -
Whether this accessor handles reading property
nameoftarget;falselets the next accessor try.targetis nevernull.override -
canWrite(
EvaluationContext context, Object target, String name) → bool -
Whether this accessor handles writing property
nameoftarget; returnfalsefor read-only properties.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
EvaluationContext context, Object target, String name) → Object? -
The value of property
nameoftarget; only called after canRead returnedtrue.override -
toString(
) → String -
A string representation of this object.
inherited
-
write(
EvaluationContext context, Object target, String name, Object? newValue) → void -
Stores
newValuein propertynameoftarget; only called after canWrite returnedtrue.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited