Seam Interceptor abstract base class
i'm experimenting with seam interceptors. I i have a custom annotation defined as:
@Target(TYPE)
@Retention(RUNTIME)
@Interceptors(SomeInterceptor.class)
public @interface MyInterceptAnnotation { }
and i have a superclass annotated with @MyInterceptAnnotati开发者_开发技巧on
@MyInterceptAnnotation
MyAbstractSuperClass{...}
is possible to have all subclasses derived from MyAbstractSuperClass intercepted?? Best regards
No, I suppose. You can try that out. However, something can be done on package
level, using package-info.java
. So, the classes belong to that particular package will get intercepted. Like below,
package-info.java
@MyInterceptAnnotation
package my.package.name;
import my.annotation.package.name.MyInterceptAnnotation;
In order to force subclasses to define the annotation, look at this thread.
Just came across a related thread, but its about Spring
. I wonder if we have similar way in Seam
. You can try to find out.
You can annotate your MyInterceptAnnotation with @Inherited which results all subclasses of MyAbstractSuperClass get intercepted too.
精彩评论