Package com.ultikits.ultitools.aop
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 ClassesModifier and TypeInterfaceDescriptionstatic classInternal implementation for annotation-based advisors. -
Method Summary
Modifier and TypeMethodDescriptionstatic AopAdvisorforAnnotation(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 intgetOrder()Gets the order of this advisor.booleanDetermines if this advisor applies to the given method.
-
Method Details
-
matches
Determines if this advisor applies to the given method.- Parameters:
method- the method to checktargetClass- 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 matchinterceptor- the interceptor to applyorder- the advisor order- Returns:
- a new annotation-based advisor
-