The object that does the work of an interface proxy: every call of the generated implementation ends up in invoke.
A library implements it for its kind of interface (for Feign, turning the call into an HTTP request) and creates it in an InvocationHandlerFactory. Applications do not implement it.
// A handler that only logs the calls.
final class LoggingHandler implements InvocationHandler {
@override
Object? invoke(ProxyMethod method, List<Object?> arguments) {
log.info('${method.name}($arguments)');
return null;
}
}
Spring (Java):
InvocationHandler handler = (proxy, method, args) -> { ... };
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
-
invoke(
ProxyMethod method, List< Object?> arguments) → Object? -
Handles a call of
methodwithargumentsand returns its result: aFutureof the value for methods that return one (ProxyMethod.isFuture). What it throws reaches the caller. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited