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