Class AopAdvisor.AnnotationAopAdvisor

java.lang.Object
com.ultikits.ultitools.aop.AopAdvisor.AnnotationAopAdvisor
All Implemented Interfaces:
AopAdvisor
Enclosing interface:
AopAdvisor

public static class AopAdvisor.AnnotationAopAdvisor extends Object implements AopAdvisor
Internal implementation for annotation-based advisors.
  • Field Details

    • annotationType

      private final Class<? extends Annotation> annotationType
    • interceptor

      private final MethodInterceptor interceptor
    • order

      private final int order
    • lookupCache

      private final AnnotationLookupCache<? extends Annotation> lookupCache
      Instance-scoped on purpose - see AnnotationLookupCache's class javadoc.
  • Constructor Details

  • Method Details

    • matches

      public boolean matches(Method method, Class<?> targetClass)
      Description copied from interface: AopAdvisor
      Determines if this advisor applies to the given method.
      Specified by:
      matches in interface AopAdvisor
      Parameters:
      method - the candidate method
      targetClass - the target class - the bean class the proxy is built for, which is what Spring's MethodMatcher means by the same parameter name. It is not the method's declaring class; for an inherited method those differ. Both call sites pass the same value at collection time and at invocation time, so an advisor's two answers cannot disagree. See issue #309.
      Returns:
      true if this advisor should intercept the method
    • getInterceptor

      public MethodInterceptor getInterceptor()
      Description copied from interface: AopAdvisor
      Gets the interceptor to apply for matching methods.
      Specified by:
      getInterceptor in interface AopAdvisor
      Returns:
      the method interceptor
    • getOrder

      public int getOrder()
      Description copied from interface: AopAdvisor
      Gets the order of this advisor. Lower values have higher priority.

      Default order is 0. Transaction advisors typically use order 100, exception handling uses order 200.

      Specified by:
      getOrder in interface AopAdvisor
      Returns:
      the order value
    • getAnnotationType

      public Class<? extends Annotation> getAnnotationType()
      Description copied from interface: AopAdvisor
      The annotation this advisor serves, for annotation-coverage checks.

      AopProxyResolver.validateAnnotationCoverage() uses this to prove that every annotation AopEligibility recognises is either served by a registered advisor or declared unavailable. An advisor whose pointcut is not annotation-based (a custom matches implementation) has nothing truthful to report here and should leave the default in place.

      Specified by:
      getAnnotationType in interface AopAdvisor
      Returns:
      the annotation type this advisor matches, or null if its pointcut logic is not annotation-based