|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.tie.ext.annotation.AnnotationPresentRule
public class AnnotationPresentRule
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.
shouldIntercept(Class, Object, MethodInterceptor),
shouldIntercept(WrappedMethodInvocation, MethodInterceptor),
AnnotationNotPresentRule| Constructor Summary | |
|---|---|
AnnotationPresentRule(Class<? extends Annotation> annotation)
|
|
| Method Summary | ||
|---|---|---|
|
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. |
|
|
shouldIntercept(WrappedMethodInvocation invocation,
MethodInterceptor interceptor)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AnnotationPresentRule(Class<? extends Annotation> annotation)
| Method Detail |
|---|
public <T> ObjectInterceptionStrategy shouldIntercept(Class<T> interfc,
T target,
MethodInterceptor interceptor)
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.
interfc is directly annotated, then the ObjectInterceptionStrategy.ALWAYS_INTERCEPT_INTERFACE strategy is used.
impl is directly annotated, then the ObjectInterceptionStrategy.ALWAYS_INTERCEPT_IMPLEMENTATION_CLASS strategy is used.
interfc contains exactly 1 method, and that method is directly annotated, then the ObjectInterceptionStrategy.ALWAYS_INTERCEPT_INTERFACE strategy is used.
interfc contains exactly 1 method, and the implementation of that method on impl is directly annotated, then the ObjectInterceptionStrategy.ALWAYS_INTERCEPT_IMPLEMENTATION_CLASS strategy is used.
interfc are annotated, then the ObjectInterceptionStrategy.INTERCEPT_SOME_METHODS_ON_INTERFACE strategy is used.
impl are annotated, then the ObjectInterceptionStrategy.INTERCEPT_SOME_METHODS_ON_IMPLEMENTATON strategy is used.
ObjectInterceptionStrategy.NEVER_INTERCEPT_IMPLEMENTATION_CLASS strategy is used.
shouldIntercept in interface InterceptionRule
public <T> MethodInterceptionStrategy shouldIntercept(WrappedMethodInvocation invocation,
MethodInterceptor interceptor)
shouldIntercept in interface InterceptionRule
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||