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 import org.jboss.aop.joinpoint.ConstructorInvocation; 28 29 import java.lang.reflect.Method ; 30 35 public class POJOMethodInterceptor implements Interceptor 36 { 37 38 public String getName() 39 { 40 return "POJOMethodInterceptor"; 41 } 42 43 public Object invoke(Invocation invocation) throws Throwable 44 { 45 Object rtn = invocation.invokeNext(); 46 wasHit = true; 47 MethodInvocation m = (MethodInvocation)invocation; 48 POJOConstructorTest pojo = (POJOConstructorTest)m.getTargetObject(); 49 String data = (String )invocation.getMetaData("test", "data"); 50 pojo.data = data; 51 return rtn; 52 } 53 54 public static boolean wasHit = false; 55 56 } 57 58 | Popular Tags |