MethodInterceptorRegistry class abstract interface

Central registry for managing method-level interceptors and their dispatching.

The MethodInterceptorRegistry provides a unified interface for registering, configuring, and retrieving method interceptors in Jetleaf’s intercept framework. It ensures that interceptors are invoked in the correct order and under the appropriate conditions.

Interceptors registered via this interface are typically instances of MethodInterceptor, which define whether a method can be intercepted based on runtime metadata, annotations, or other criteria. The dispatcher (MethodInterceptorDispatcher) coordinates execution of these interceptors, allowing complex method interception workflows such as pre-processing, post-processing, and exception handling.

The registry supports flexible ordering, allowing interceptors to be executed in priority order, annotated order, or default registration order.

Example Usage

final registry = DefaultMethodInterceptorRegistry();

// Add a logging interceptor that applies only to public methods
registry.addMethodInterceptor(LoggingInterceptor());

// Add a security interceptor with high priority
registry.addMethodInterceptor(SecurityInterceptor());

// Set the dispatcher responsible for executing interceptors
registry.setMethodInterceptorDispatcher(DefaultInterceptorDispatcher());
Implementers

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

addMethodInterceptor(MethodInterceptor interceptor, [String? podName]) → void
Registers a MethodInterceptor with this registry.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setMethodInterceptorDispatcher(MethodInterceptorDispatcher dispatcher) → void
Sets the MethodInterceptorDispatcher that executes the registered interceptors.
toString() → String
A string representation of this object.
inherited

Operators

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