public abstract class AnnotationMethodInterceptor extends MethodInterceptorSupport
MethodInvocation
via a
AnnotationResolver
instance that may be configured. Unless
overridden, the default AnnotationResolver
is aConstructor and Description |
---|
AnnotationMethodInterceptor(AnnotationHandler handler)
Constructs an
AnnotationMethodInterceptor with the
AnnotationHandler that will be used to process annotations of a
corresponding type. |
AnnotationMethodInterceptor(AnnotationHandler handler,
AnnotationResolver resolver)
Constructs an
AnnotationMethodInterceptor with the
AnnotationHandler that will be used to process annotations of a
corresponding type, using the specified AnnotationResolver to acquire annotations
at runtime. |
Modifier and Type | Method and Description |
---|---|
protected Annotation |
getAnnotation(MethodInvocation mi)
Returns the Annotation that this interceptor will process for the specified method invocation.
|
AnnotationHandler |
getHandler()
Returns the
AnnotationHandler used to perform authorization behavior based on
an annotation discovered at runtime. |
AnnotationResolver |
getResolver()
Returns the
AnnotationResolver to use to acquire annotations from intercepted
methods at runtime. |
void |
setHandler(AnnotationHandler handler)
Sets the
AnnotationHandler used to perform authorization behavior based on
an annotation discovered at runtime. |
void |
setResolver(AnnotationResolver resolver)
Returns the
AnnotationResolver to use to acquire annotations from intercepted
methods at runtime. |
boolean |
supports(MethodInvocation mi)
Returns
true if this interceptor supports, that is, should inspect, the specified
MethodInvocation , false otherwise. |
getSubject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invoke
public AnnotationMethodInterceptor(AnnotationHandler handler)
AnnotationMethodInterceptor
with the
AnnotationHandler
that will be used to process annotations of a
corresponding type.handler
- the handler to delegate to for processing the annotation.public AnnotationMethodInterceptor(AnnotationHandler handler, AnnotationResolver resolver)
AnnotationMethodInterceptor
with the
AnnotationHandler
that will be used to process annotations of a
corresponding type, using the specified AnnotationResolver
to acquire annotations
at runtime.handler
- the handler to use to process any discovered annotationresolver
- the resolver to use to locate/acquire the annotationpublic AnnotationHandler getHandler()
AnnotationHandler
used to perform authorization behavior based on
an annotation discovered at runtime.AnnotationHandler
used to perform authorization behavior based on
an annotation discovered at runtime.public void setHandler(AnnotationHandler handler)
AnnotationHandler
used to perform authorization behavior based on
an annotation discovered at runtime.handler
- the AnnotationHandler
used to perform authorization behavior based on
an annotation discovered at runtime.public AnnotationResolver getResolver()
AnnotationResolver
to use to acquire annotations from intercepted
methods at runtime. The annotation is then used by the handler
to
perform authorization logic.AnnotationResolver
to use to acquire annotations from intercepted
methods at runtime.public void setResolver(AnnotationResolver resolver)
AnnotationResolver
to use to acquire annotations from intercepted
methods at runtime. The annotation is then used by the handler
to
perform authorization logic.resolver
- the AnnotationResolver
to use to acquire annotations from intercepted
methods at runtime.public boolean supports(MethodInvocation mi)
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
mi
- the MethodInvocation
for the method being invoked.true
if this interceptor supports, that is, should inspect, the specified
MethodInvocation
, false
otherwise.protected Annotation getAnnotation(MethodInvocation mi)
resolver
using the internal annotation handler
's
annotationClass
.mi
- the MethodInvocation wrapping the Method from which the Annotation will be acquired.Copyright © 2004–2020 The Apache Software Foundation. All rights reserved.