FunctionMethodResolver<T extends Object> class
final
A MethodResolver for objects of type T, built from one function per
method name.
Use it to let expressions call a few methods of a class that is not
@Introspected. Each function gets the target and the list of
evaluated arguments, whatever their number, and checks them itself;
arguments are not converted.
// greet('Bob') can be called on a User.
final context = StandardEvaluationContext(user)
..addMethodResolver(FunctionMethodResolver<User>({
'greet': (u, args) => 'Hi ${args.first}, I am ${u.name}',
}));
SpelExpressionParser()
.parseExpression("greet('Bob')")
.getValue(context); // 'Hi Bob, I am Ada'
Spring (Java):
// Spring finds greet(String) by reflection (ReflectiveMethodResolver):
parser.parseExpression("greet('Bob')").getValue(context);
- Implemented types
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolve(
EvaluationContext context, Object target, String name, List< Object?> arguments) → MethodExecutor? -
An executor that runs method
nameontargetwitharguments(already evaluated), ornullto let the next resolver try.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited