org.apache.shiro.aop
Class AnnotationMethodInterceptor
java.lang.Object
org.apache.shiro.aop.MethodInterceptorSupport
org.apache.shiro.aop.AnnotationMethodInterceptor
- All Implemented Interfaces:
- MethodInterceptor
- Direct Known Subclasses:
- AuthorizingAnnotationMethodInterceptor
public abstract class AnnotationMethodInterceptor
- extends MethodInterceptorSupport
MethodInterceptor that inspects a specific annotation on the method invocation before continuing
its execution.
- Since:
- 0.9
- Author:
- Les Hazlewood
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationMethodInterceptor
public AnnotationMethodInterceptor(AnnotationHandler handler)
- Constructs an
AnnotationMethodInterceptor with the
AnnotationHandler that will be used to process annotations of a corresponding
type.
- Parameters:
handler - the handler to delegate to for processing the annotation.
getHandler
public AnnotationHandler getHandler()
setHandler
public void setHandler(AnnotationHandler handler)
supports
public boolean supports(MethodInvocation mi)
- Returns
true if this interceptor supports, that is, should inspect, the specified
MethodInvocation, false otherwise.
The default implementation simply does the following:
return getAnnotation(mi) != null
- Parameters:
mi - the MethodInvocation for the method being invoked.
- Returns:
true if this interceptor supports, that is, should inspect, the specified
MethodInvocation, false otherwise.
getAnnotation
protected Annotation getAnnotation(MethodInvocation mi)
throws IllegalArgumentException
- Returns the Annotation that this interceptor will process for the specified method invocation.
The default implementation merely gets the underlying
Method from the supplied
MethodInvocation argument, and returns:
mi.getAnnotation(handler.getAnnotationClass());
- Parameters:
mi - the MethodInvocation wrapping the Method from which the Annotation will be acquired.
- Returns:
- the Annotation that this interceptor will process for the specified method invocation.
- Throws:
IllegalArgumentException - if the supplied MethodInvocation argument is null or
its underlying Method is null.
Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.