MethodInterceptor class abstract interface

Defines the core interception contract for JetLeaf’s AOP (Aspect-Oriented Programming) framework, allowing runtime interception and augmentation of method invocations.

Implementations of MethodInterceptor can selectively intercept method calls based on metadata, annotations, or execution context.
Each interceptor determines its applicability via canIntercept, enabling fine-grained interception pipelines.

Interception Lifecycle

  1. JetLeaf identifies candidate interceptors for a given Method.
  2. Each interceptor’s canIntercept is evaluated.
  3. Interceptors returning true are added to the execution chain.
  4. Depending on their subtype, they may act before, after, or around the method invocation.

Example

final interceptor = TransactionInterceptor();
if (interceptor.canIntercept(method)) {
  await interceptor.beforeInvocation(invocation);
}

Typical Implementations

See Also

Mixed-in types

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

canIntercept(Method method) bool
Determines whether this interceptor can intercept the specified method.
equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
inherited
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