From: neil_g_avery <nu...@jb...> - 2005-07-05 10:58:13
|
Hi All, Ive been trying to use a class level TYPE annotations to work with java 5 but have had no luck. Digging through the tests I found the instanceofannotated test package which works only for pre java 5. The binding between the TYPE annotation and interceptor doesnt occur and my interceptor never gets called - can anyone tell me what Im doing wrong? ps. I would like to use an aspect rather than an interceptor; which is where i started before copying the examples - so some of the naming looks a little confused. Regards Neil. jboss-aop.xml <aop> | <!-- <aspect class="org.neo.swarm.interceptor.within.WithinAspect" scope="PER_INSTANCE" /> --> | | <interceptor name="aspect" class="org.neo.swarm.interceptor.within.WithinAspectInterceptor"/> | | <bind pointcut="execution(String $instanceof{@org.neo.swarm.interceptor.within.InterceptWithin}->doStuff())"> | <interceptor-ref name="aspect"/> | </bind> | </aop> annotation def | @Retention(RetentionPolicy.RUNTIME) | @Target(ElementType.TYPE) | public @interface InterceptWithin { | | } | interceptor | public class WithinAspectInterceptor implements Interceptor { | | public WithinAspectInterceptor(){ | System.err.println("created interceptor"); | } | public String getName() { | return "aspect"; | } | | public Object invoke(Invocation invocation) throws Throwable { | System.err.println("Interceptor within got called with:" + invocation); | return invocation.invokeNext(); | } | } the annotated test component @InterceptWithin | public class SomeComponent { | public String doStuff(){ | return "stuff"; | } | | } the test public void testWithin() throws Exception { | SomeComponent component = new SomeComponent(); | component.doStuff(); | | } | View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3883642#3883642 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3883642 |