1 22 import org.jboss.aop.joinpoint.Invocation; 23 import org.jboss.aop.joinpoint.FieldWriteInvocation; 24 import org.jboss.aop.advice.Interceptor; 25 26 31 public class SetInterceptor implements Interceptor 32 { 33 public String getName() { return "SetInterceptor"; } 34 35 public Object invoke(Invocation invocation) throws Throwable 36 { 37 if (!(invocation instanceof FieldWriteInvocation)) return invocation.invokeNext(); 38 try 39 { 40 FieldWriteInvocation mi = (FieldWriteInvocation)invocation; 41 System.out.println("<<< Entering SetInterceptor for: " + mi.getField().getName()); 42 return invocation.invokeNext(); 43 } 44 finally 45 { 46 System.out.println(">>> Leaving SetInterceptor"); 47 } 48 } 49 } 50 | Popular Tags |