1 22 package org.jboss.test.aop.bean; 23 24 import org.jboss.aop.advice.Interceptor; 25 import org.jboss.aop.joinpoint.Invocation; 26 import org.jboss.aop.joinpoint.MethodInvocation; 27 28 import java.lang.reflect.Method ; 29 34 public class AfterInterceptor implements org.jboss.aop.advice.Interceptor 35 { 36 37 public String getName() 38 { 39 return "AfterInterceptor"; 40 } 41 42 public Object invoke(org.jboss.aop.joinpoint.Invocation invocation) throws Throwable 43 { 44 System.out.println("AfterInterceptor interception: " + invocation.getClass().getName()); 45 org.jboss.aop.joinpoint.MethodInvocation methodInvocation = (org.jboss.aop.joinpoint.MethodInvocation)invocation; 46 Method m = methodInvocation.getMethod(); 47 lastIntercepted = m.getName(); 48 String transattr = (String )invocation.getMetaData("transaction", "trans-attribute"); 49 System.out.println("trans-attribute: " + transattr); 50 lastTransAttributeAccessed = transattr; 51 return invocation.invokeNext(); 52 } 53 54 public static String lastIntercepted; 55 public static String lastTransAttributeAccessed; 56 } 57 58 | Popular Tags |