1 22 import org.jboss.aop.joinpoint.Invocation; 23 import org.jboss.aop.joinpoint.ConstructorInvocation; 24 import org.jboss.aop.advice.Interceptor; 25 import java.lang.reflect.*; 26 27 32 public class DependencyInjectorInterceptor implements Interceptor 33 { 34 public String getName() { return "ConstructorInterceptor"; } 35 36 public Object invoke(Invocation invocation) throws Throwable  37 { 38 Object val = invocation.invokeNext(); 39 Method method = val.getClass().getMethod("setInjectedParameter", new Class [] { Integer.TYPE }); 40 method.invoke(val, new Object [] { new Integer (55) }); 41 return val; 42 } 43 } 44 | Popular Tags |