1 package alt.jiapi; 2 3 import alt.jiapi.InstrumentationException; 4 import alt.jiapi.Instrumentor; 5 import alt.jiapi.reflect.JiapiClass; 6 import alt.jiapi.reflect.JiapiMethod; 7 8 import org.apache.log4j.Category; 9 10 16 public abstract class MethodInstrumentor implements Instrumentor { 17 private static Category log = Category.getInstance(MethodInstrumentor.class); 18 23 public void instrument(JiapiClass clazz) throws InstrumentationException { 24 log.debug("Instrumenting " + clazz.getName()); 25 JiapiMethod[] methods = clazz.getDeclaredMethods(); 26 for (int i = 0; i < methods.length; i++) { 27 if (methods[i].getInstructionList() != null) { 28 instrument(methods[i]); 29 } 30 else { 31 log.debug("Won't instrument " + clazz + "#" + methods[i] + 32 ", it has no instructions"); 33 } 34 } 35 } 36 37 public abstract void instrument(JiapiMethod m) throws InstrumentationException; 38 } 39 | Popular Tags |