1 22 package org.jboss.test.aop.basic; 23 24 import org.jboss.logging.Logger; 25 26 import java.lang.reflect.Method ; 27 28 31 public class SimpleBeanInterceptor implements org.jboss.aop.advice.Interceptor 32 { 33 34 static Logger log = Logger.getLogger(SimpleBeanInterceptor.class); 35 public static final String RETURN_VALUE = "aspect"; 36 37 public String getName() 38 { 39 return "SimpleInterceptor"; 40 } 41 42 public Object invoke(org.jboss.aop.joinpoint.Invocation invocation) throws Throwable 43 { 44 log.info("in SimpleBeanInterceptor"); 45 org.jboss.aop.joinpoint.MethodInvocation methodInvocation = (org.jboss.aop.joinpoint.MethodInvocation) invocation; 46 final Method m = methodInvocation.getMethod(); 47 if ("getTest".equals(m.getName()) 48 && "org.jboss.test.aop.simpleejb.SimpleBean".equals(m.getDeclaringClass().getName())) 49 { 50 return RETURN_VALUE; 51 } 52 else 53 { 54 return invocation.invokeNext(); 55 } 56 } 57 } 58 | Popular Tags |