net.sf.tie.ext.annotation
Class AnnotationPresentRule
java.lang.Object
net.sf.tie.ext.annotation.AnnotationPresentRule
- All Implemented Interfaces:
- InterceptionRule
public class AnnotationPresentRule
- extends Object
- implements InterceptionRule
An InterceptionRule
that tests for the presence of a specific Annotation
.
Because this is a runtime test, the annotation must have runtime retention
.
The annotation may be on the interface, the implementation, or on methods of either of these.
The rule will derive the correct interception strategy according to the placement of the annotation.
- See Also:
shouldIntercept(Class, Object, MethodInterceptor)
,
shouldIntercept(WrappedMethodInvocation, MethodInterceptor)
,
AnnotationNotPresentRule
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationPresentRule
public AnnotationPresentRule(Class<? extends Annotation> annotation)
shouldIntercept
public <T> ObjectInterceptionStrategy shouldIntercept(Class<T> interfc,
T target,
MethodInterceptor interceptor)
- Inspects
interfc
and target
and determines the correct ObjectInterceptionStrategy
to use
based on the presence (or otherwise) of the specific annotation
.
Let impl
be the Class
of target
. The following rules are applied in order.
- Specified by:
shouldIntercept
in interface InterceptionRule
shouldIntercept
public <T> MethodInterceptionStrategy shouldIntercept(WrappedMethodInvocation invocation,
MethodInterceptor interceptor)
- Specified by:
shouldIntercept
in interface InterceptionRule