类 DelegatePerTargetObjectIntroductionInterceptor

java.lang.Object
infra.aop.support.IntroductionInfoSupport
infra.aop.support.DelegatePerTargetObjectIntroductionInterceptor
所有已实现的接口:
DynamicIntroductionAdvice, IntroductionInfo, IntroductionInterceptor, Serializable, Advice, Interceptor, MethodInterceptor

public class DelegatePerTargetObjectIntroductionInterceptor extends IntroductionInfoSupport implements IntroductionInterceptor
Convenient implementation of the IntroductionInterceptor interface.

This differs from DelegatingIntroductionInterceptor in that a single instance of this class can be used to advise multiple target objects, and each target object will have its own delegate (whereas DelegatingIntroductionInterceptor shares the same delegate, and hence the same state across all targets).

The suppressInterface method can be used to suppress interfaces implemented by the delegate class but which should not be introduced to the owning AOP proxy.

An instance of this class is serializable if the delegates are.

Note: There are some implementation similarities between this class and DelegatingIntroductionInterceptor that suggest a possible refactoring to extract a common ancestor class in the future.

从以下版本开始:
3.0
作者:
Adrian Colyer, Juergen Hoeller, TODAY 2021/3/8 22:21
另请参阅:
  • 字段详细资料

    • serialVersionUID

      private static final long serialVersionUID
      另请参阅:
    • delegateMap

      private final WeakHashMap<Object,Object> delegateMap
      Hold weak references to keys as we don't want to interfere with garbage collection..
    • interfaceType

      private final Class<?> interfaceType
    • defaultImplType

      private final Class<?> defaultImplType
  • 构造器详细资料

    • DelegatePerTargetObjectIntroductionInterceptor

      public DelegatePerTargetObjectIntroductionInterceptor(Class<?> defaultImplType, Class<?> interfaceType)
  • 方法详细资料

    • invoke

      public Object invoke(MethodInvocation mi) throws Throwable
      Subclasses may need to override this if they want to perform custom behaviour in around advice. However, subclasses should invoke this method, which handles introduced interfaces and forwarding to the target.
      指定者:
      invoke 在接口中 MethodInterceptor
      参数:
      mi - the method invocation joinpoint
      返回:
      the result of the call to Joinpoint.proceed(), might be intercepted by the interceptor.
      抛出:
      Throwable - if the interceptors or the target-object throws an exception.
    • doProceed

      protected Object doProceed(MethodInvocation mi) throws Throwable
      Proceed with the supplied MethodInterceptor. Subclasses can override this method to intercept method invocations on the target object which is useful when an introduction needs to monitor the object that it is introduced into. This method is never called for MethodInvocations on the introduced interfaces.
      抛出:
      Throwable
    • getIntroductionDelegateFor

      private Object getIntroductionDelegateFor(Object targetObject)
    • createNewDelegate

      private Object createNewDelegate()