MethodInvocation<T> class abstract interface

Represents a reflective method invocation within the interception pipeline.

The MethodInvocation interface abstracts the context of a method call, encapsulating the target object, method metadata, arguments, and the executable request itself. It serves as the central contract between JetLeaf’s intercept framework and its interceptors.

Each method call intercepted by the framework is represented as a MethodInvocation instance, allowing interceptors and advices to:

  • Inspect or modify arguments before invocation
  • Execute pre- or post-invocation logic
  • Replace or short-circuit the method call entirely

Example

class LoggingInterceptor implements MethodInterceptor {
  @override
  Future<Object?> invoke(MethodInvocation invocation) async {
    print('Invoking: ${invocation.getMethod().getName()}');
    final result = await invocation.getOriginalRequest()();
    print('Completed: ${invocation.getMethod().getName()}');
    return result;
  }
}

@see ExecutableArgument @see AsyncMethodInvocator

Implementers
Annotations
  • @Generic.new(MethodInvocation)

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

flush() Future<void>
Flushes this stream by writing any buffered output to the underlying stream.
inherited
getArgument() → ExecutableArgument?
Retrieves the structured arguments for the method invocation.
getMethod() → Method
Retrieves the method metadata for the current invocation.
getTarget() Object
Retrieves the target object on which the method is being invoked.
getTargetClass() → Class
Retrieves the reflective class metadata of the target object.
hijack(T value) Future<void>
Immediately short‑circuits the invocation pipeline by supplying a custom return value.
isInvoked() bool
Indicates whether the target method has already been invoked within the current operation context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
proceed([bool retry = false]) Future<T>
Proceeds with the execution of the target method or operation.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited