Interface AopAdvisor

All Known Implementing Classes:
AopAdvisor.AnnotationAopAdvisor

public interface AopAdvisor
An advisor that combines a pointcut (when to apply) with advice (what to do).

Advisors determine which methods should be intercepted and provide the interceptor to apply to those methods.

Since:
6.2.0
Author:
wisdomme
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Internal implementation for annotation-based advisors.
  • Method Summary

    Modifier and Type
    Method
    Description
    static AopAdvisor
    forAnnotation(Class<? extends Annotation> annotationType, MethodInterceptor interceptor, int order)
    Creates an advisor that matches methods or classes with the given annotation.
    Gets the interceptor to apply for matching methods.
    default int
    Gets the order of this advisor.
    boolean
    matches(Method method, Class<?> targetClass)
    Determines if this advisor applies to the given method.
  • Method Details

    • matches

      boolean matches(Method method, Class<?> targetClass)
      Determines if this advisor applies to the given method.
      Parameters:
      method - the method to check
      targetClass - the class declaring the method
      Returns:
      true if this advisor should intercept the method
    • getInterceptor

      MethodInterceptor getInterceptor()
      Gets the interceptor to apply for matching methods.
      Returns:
      the method interceptor
    • getOrder

      default int getOrder()
      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.

      Returns:
      the order value
    • forAnnotation

      static AopAdvisor forAnnotation(Class<? extends Annotation> annotationType, MethodInterceptor interceptor, int order)
      Creates an advisor that matches methods or classes with the given annotation.
      Parameters:
      annotationType - the annotation to match
      interceptor - the interceptor to apply
      order - the advisor order
      Returns:
      a new annotation-based advisor