2 Replies Latest reply on Jul 5, 2005 11:00 AM by Neil Avery

    problems getting @TYPE annotation and $instanceof on java5 t

    Neil Avery Newbie

      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

      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.


      <!-- <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"/>

      annotation def
      public @interface InterceptWithin {

      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

      public class SomeComponent {
       public String doStuff(){
       return "stuff";

      the test
      public void testWithin() throws Exception {
       SomeComponent component = new SomeComponent();