1 22 package org.jboss.test.aop.jdk15.annotated; 23 24 import java.lang.reflect.Field ; 25 import java.lang.reflect.Method ; 26 27 import org.jboss.aop.joinpoint.FieldReadInvocation; 28 import org.jboss.aop.joinpoint.FieldWriteInvocation; 29 import org.jboss.aop.joinpoint.MethodInvocation; 30 31 36 @org.jboss.aop.InterceptorDef (scope=org.jboss.aop.advice.Scope.PER_VM) 37 @org.jboss.aop.Bind (pointcut="execution(* org.jboss.test.aop.jdk15.annotated.VariaPOJO*->methodWithInterceptor())") 38 public class CountingInterceptor implements org.jboss.aop.advice.Interceptor 39 { 40 41 public String getName() 42 { 43 return "CountingInterceptor"; 44 } 45 46 public Object invoke(org.jboss.aop.joinpoint.Invocation invocation) throws Throwable 47 { 48 System.out.println("CountingInterceptor interception: " + invocation.getClass().getName()); 49 count++; 50 System.out.println("CountingInterceptor.count:" + count); 51 return invocation.invokeNext(); 52 } 53 54 public static int count; 55 } 56 57 | Popular Tags |