1 22 package org.jboss.test.aop.scoped; 23 24 import org.jboss.aop.advice.Interceptor; 25 import org.jboss.aop.joinpoint.Invocation; 26 import org.jboss.aop.joinpoint.MethodInvocation; 27 28 33 public class ScopedInterceptor implements Interceptor 34 { 35 public static int intercepted; 36 public static int value; 37 38 public String getName() 39 { 40 return this.getClass().getName(); 41 } 42 43 public void setValue(int i) 44 { 45 value = i; 46 } 47 48 public Object invoke(Invocation invocation) throws Throwable 49 { 50 System.out.println("--- ScopedInterceptor intercepting " + getClass().getClassLoader()); 51 intercepted++; 52 53 if (invocation instanceof MethodInvocation) 54 { 55 MethodInvocation mi = (MethodInvocation)invocation; 56 if (mi.getMethod().getName().equals("testMethod")) 57 { 58 return null; 59 } 60 } 61 62 return invocation.invokeNext(); 63 } 64 65 } 66 | Popular Tags |