Interface Interceptor

All Superinterfaces:
Advice
All Known Subinterfaces:
ConstructorInterceptor, IntroductionInterceptor, MethodInterceptor
All Known Implementing Classes:
AbstractMonitoringInterceptor, AbstractTraceInterceptor, AfterReturningAdviceInterceptor, AnnotationAsyncExecutionInterceptor, AspectJAfterAdvice, AspectJAfterThrowingAdvice, AspectJAroundAdvice, AsyncExecutionInterceptor, CacheInterceptor, ConcurrencyThrottleInterceptor, CustomizableTraceInterceptor, DebugInterceptor, DelegatePerTargetObjectIntroductionInterceptor, DelegatingIntroductionInterceptor, EventPublicationInterceptor, ExposeInvocationInterceptor, JCacheInterceptor, MBeanClientInterceptor, MBeanProxyFactoryBean, MethodBeforeAdviceInterceptor, MethodValidationInterceptor, OpenSessionInterceptor, PerformanceMonitorInterceptor, PersistenceExceptionTranslationInterceptor, SimpleTraceInterceptor, ThrowsAdviceInterceptor, TransactionInterceptor

public interface Interceptor extends Advice
This interface represents a generic interceptor.

A generic interceptor can intercept runtime events that occur within a base program. Those events are materialized by (reified in) joinpoints. Runtime joinpoints can be invocations, field access, exceptions...

This interface is not used directly. Use the sub-interfaces to intercept specific events. For instance, the following class implements some specific interceptors in order to implement a debugger:

 class DebuggingInterceptor implements MethodInterceptor,
     ConstructorInterceptor {

   Object invoke(MethodInvocation i) throws Throwable {
     debug(i.getMethod(), i.getThis(), i.getArgs());
     return i.proceed();
   }

   Object construct(ConstructorInvocation i) throws Throwable {
     debug(i.getConstructor(), i.getThis(), i.getArgs());
     return i.proceed();
   }

   void debug(AccessibleObject ao, Object this, Object value) {
     ...
   }
 }
 
Author:
Rod Johnson
See Also: