Package org.apache.shiro.aop
Class DefaultAnnotationResolver
- java.lang.Object
-
- org.apache.shiro.aop.DefaultAnnotationResolver
-
- All Implemented Interfaces:
AnnotationResolver
public class DefaultAnnotationResolver extends Object implements AnnotationResolver
DefaultAnnotationResolver
implementation that merely inspects theMethodInvocation
'starget method
, and returnstargetMethod
.getAnnotation(class)
. Unfortunately Java's default reflection API for Annotations is not very robust, and this logic may not be enough - if the incoming method invocation represents a method from an interface, this default logic would not discover the annotation if it existed on the method implementation directly (as opposed to being defined directly in the interface definition). More complex class hierarchy traversal logic is required to exhaust a method's target object's classes, parent classes, interfaces and parent interfaces. That logic will likely be added to this implementation in due time, but for now, this implementation relies on the JDK's defaultMethod.getAnnotation(class)
logic.- Since:
- 1.1
-
-
Constructor Summary
Constructors Constructor Description DefaultAnnotationResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Annotation
getAnnotation(MethodInvocation mi, Class<? extends Annotation> clazz)
-
-
-
Method Detail
-
getAnnotation
public Annotation getAnnotation(MethodInvocation mi, Class<? extends Annotation> clazz)
- Specified by:
getAnnotation
in interfaceAnnotationResolver
- Parameters:
mi
- the intercepted method to be invoked.clazz
- the annotation class to use to find an annotation instance on the method.- Returns:
- the discovered annotation or
null
if an annotation instance could not be found.
-
-