1 22 package org.jboss.aop.instrument; 23 24 25 import javassist.CannotCompileException; 26 import javassist.CtClass; 27 import javassist.CtMethod; 28 import javassist.Modifier; 29 import javassist.NotFoundException; 30 31 37 public class GeneratedAdvisorCallerInfoAdder extends CallerInfoAdder 38 { 39 public GeneratedAdvisorCallerInfoAdder(Instrumentor instrumentor) 40 { 41 super(instrumentor, Modifier.PROTECTED); 42 } 43 44 protected void addMethodByMethodInfoField(CtClass addTo, String fieldName, long callingHash, String classname, long calledHash) throws NotFoundException, CannotCompileException 45 { 46 String init = "resolveCallerMethodInfo(" + callingHash + "L, \"" + classname + "\", " + calledHash + "L)"; 47 addMethodByMethodInfoField(addTo, fieldName, null); 48 ((GeneratedAdvisorInstrumentor)instrumentor).initialiseCallerInfoField(fieldName, init); 49 } 50 51 protected void addConByMethodInfoField(CtClass addTo, String fieldName, long callingHash, String classname, long calledHash) throws NotFoundException, CannotCompileException 52 { 53 String init = "resolveCallerConstructorInfo(" + callingHash + "L, \"" + classname + "\", " + calledHash + "L)"; 54 addConByMethodInfoField(addTo, fieldName, null); 55 ((GeneratedAdvisorInstrumentor)instrumentor).initialiseCallerInfoField(fieldName, init); 56 } 57 58 protected void addConByConInfoField(CtClass addTo, String fieldName, int callingIndex, String classname, long calledHash) throws NotFoundException, CannotCompileException 59 { 60 String init = "resolveConstructorCallerConstructorInfo(" + callingIndex + ", \"" + classname + "\", " + calledHash + "L)"; 61 addConByConInfoField(addTo, fieldName, null); 62 ((GeneratedAdvisorInstrumentor)instrumentor).initialiseCallerInfoField(fieldName, init); 63 } 64 65 protected void addMethodByConInfoField(CtClass addTo, String fieldName, int callingIndex, String classname, long calledHash) throws NotFoundException, CannotCompileException 66 { 67 String init = "resolveConstructorCallerMethodInfo(" + callingIndex + ", \"" + classname + "\", " + calledHash + "L)"; 68 addMethodByConInfoField(addTo, fieldName, null); 69 ((GeneratedAdvisorInstrumentor)instrumentor).initialiseCallerInfoField(fieldName, init); 70 } 71 72 protected boolean addInfoAsWeakReference() 73 { 74 return false; 75 } 76 } 77 | Popular Tags |