This content has been marked as final.
Show 1 reply
-
1. Re: add interceptor binding programmatically
matlach Mar 18, 2013 6:53 PM (in response to matlach)I have finally noticed that Seam has been halted : http://seamframework.org
Since I figured also that Solder was providing the AnnotatedTypeBuilder, I just grabbed the apache deltaspike one (where solder moved) and now I can add my interceptor binding dynamically :
public class MyInterceptorExtension implements Extension { <T> void processAnnotatedType(@Observes final ProcessAnnotatedType<T> pat) { class MyInterceptorLiteral extends AnnotationLiteral<MyInterceptor> { private static final long serialVersionUID = 1L; } if (pat.getAnnotatedType().getJavaClass().isAnnotationPresent(ApplicationScoped.class)){ final AnnotatedTypeBuilder<T> builder = new AnnotatedTypeBuilder<T>() .readFromType(pat.getAnnotatedType(), true) .addToClass(new ValidateMethodLiteral()); pat.setAnnotatedType(builder.create()); } } }