Package com.ultikits.ultitools.aop
Class AopAdvisor.AnnotationAopAdvisor
java.lang.Object
com.ultikits.ultitools.aop.AopAdvisor.AnnotationAopAdvisor
- All Implemented Interfaces:
AopAdvisor
- Enclosing interface:
AopAdvisor
Internal implementation for annotation-based advisors.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ultikits.ultitools.aop.AopAdvisor
AopAdvisor.AnnotationAopAdvisor -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Class<? extends Annotation> private final MethodInterceptorprivate final AnnotationLookupCache<? extends Annotation> Instance-scoped on purpose - see AnnotationLookupCache's class javadoc.private final int -
Constructor Summary
ConstructorsConstructorDescriptionAnnotationAopAdvisor(Class<? extends Annotation> annotationType, MethodInterceptor interceptor, int order) AnnotationAopAdvisor(Class<? extends Annotation> annotationType, MethodInterceptor interceptor, int order, AnnotationLookupCache<? extends Annotation> lookupCache) -
Method Summary
Modifier and TypeMethodDescriptionClass<? extends Annotation> The annotation this advisor serves, for annotation-coverage checks.Gets the interceptor to apply for matching methods.intgetOrder()Gets the order of this advisor.booleanDetermines if this advisor applies to the given method.
-
Field Details
-
annotationType
-
interceptor
-
order
private final int order -
lookupCache
Instance-scoped on purpose - see AnnotationLookupCache's class javadoc.
-
-
Constructor Details
-
AnnotationAopAdvisor
AnnotationAopAdvisor(Class<? extends Annotation> annotationType, MethodInterceptor interceptor, int order) -
AnnotationAopAdvisor
AnnotationAopAdvisor(Class<? extends Annotation> annotationType, MethodInterceptor interceptor, int order, AnnotationLookupCache<? extends Annotation> lookupCache)
-
-
Method Details
-
matches
Description copied from interface:AopAdvisorDetermines if this advisor applies to the given method.- Specified by:
matchesin interfaceAopAdvisor- Parameters:
method- the candidate methodtargetClass- the target class - the bean class the proxy is built for, which is what Spring'sMethodMatchermeans 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
Description copied from interface:AopAdvisorGets the interceptor to apply for matching methods.- Specified by:
getInterceptorin interfaceAopAdvisor- Returns:
- the method interceptor
-
getOrder
public int getOrder()Description copied from interface:AopAdvisorGets 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:
getOrderin interfaceAopAdvisor- Returns:
- the order value
-
getAnnotationType
Description copied from interface:AopAdvisorThe annotation this advisor serves, for annotation-coverage checks.AopProxyResolver.validateAnnotationCoverage()uses this to prove that every annotationAopEligibilityrecognises is either served by a registered advisor or declared unavailable. An advisor whose pointcut is not annotation-based (a custommatchesimplementation) has nothing truthful to report here and should leave the default in place.- Specified by:
getAnnotationTypein interfaceAopAdvisor- Returns:
- the annotation type this advisor matches, or
nullif its pointcut logic is not annotation-based
-