/* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ import org.jboss.aop.joinpoint.Invocation; import org.jboss.aop.joinpoint.ConstructorInvocation; import org.jboss.aop.advice.Interceptor; import java.lang.reflect.*; /** * * @author Bill Burke * @version $Revision: 1.1 $ */ public class DependencyInjectorInterceptor implements Interceptor { public String getName() { return "ConstructorInterceptor"; } public Object invoke(Invocation invocation) throws Throwable { Object val = invocation.invokeNext(); Method method = val.getClass().getMethod("setInjectedParameter", new Class[] { Integer.TYPE }); method.invoke(val, new Object[] { new Integer(55) }); return val; } }