1 22 package org.jboss.aop.instrument; 23 24 import javassist.CtConstructor; 25 import javassist.Modifier; 26 27 import org.jboss.aop.AspectManager; 28 29 35 public class NonOptimizedConstructionTransformer extends 36 ConstructionTransformer 37 { 38 39 public NonOptimizedConstructionTransformer(Instrumentor instrumentor) 40 { 41 super(instrumentor); 42 } 43 44 protected void insertInterception(CtConstructor constructor, int index) throws Exception 45 { 46 String args = ""; 47 if (constructor.getParameterTypes().length > 0) 48 { 49 args = ", $args"; 50 } 51 52 String infoName = getConstructionInfoFieldName(constructor.getDeclaringClass().getSimpleName(), index); 53 54 String code = 55 " " + constructionInfoFromWeakReference("info", infoName) + 56 " org.jboss.aop.advice.Interceptor[] interceptors = info.getInterceptors(); " + 57 " if (interceptors != (org.jboss.aop.advice.Interceptor[])null) " + 58 " { " + 59 " org.jboss.aop.joinpoint.ConstructionInvocation invocation = new org.jboss.aop.joinpoint.ConstructionInvocation(interceptors, " + 60 Instrumentor.HELPER_FIELD_NAME + ".getConstructors()[" + index + "]" + args + "); " + 61 " invocation.setAdvisor(" + Instrumentor.HELPER_FIELD_NAME + "); " + 62 " invocation.setTargetObject(this); " + 63 " invocation.invokeNext(); " + 64 " } "; 65 constructor.insertAfter(code, false); 66 } 67 68 } 69 | Popular Tags |