1 18 19 package alt.jiapi.event; 20 21 29 public class MethodEvent extends JiapiEvent { 30 33 public static final int METHOD_ENTERED = 1; 34 35 38 public static final int METHOD_EXITED = 2; 39 40 private Object [] methodArgs; 41 42 52 public MethodEvent(MethodEventProducer mep, Object sourceObject, 53 String methodName, int id) { 54 this(mep, sourceObject, methodName, null, null, id); 55 } 56 57 58 70 public MethodEvent(MethodEventProducer mep, Object sourceObject, 71 String methodName, Object target, 72 Object [] methodArgs, int id) { 73 super(mep, sourceObject, methodName, target, id); 74 75 this.methodArgs = methodArgs; 76 } 77 78 82 public Object [] getMethodArgs() { 83 return methodArgs; 84 } 85 86 91 public String getClassName() { 92 if (sourceObject instanceof String ) { 93 return (String )sourceObject; 94 } 95 if (sourceObject instanceof Class ) { 96 return ((Class )sourceObject).getName(); 99 } 100 101 return sourceObject.getClass().getName(); 102 } 103 104 108 public String getMethodName() { 109 return super.getTargetName(); 110 } 111 112 116 public boolean isConstructor() { 117 return "<init>".equals(getMethodName()); 118 } 119 120 124 public boolean isStaticInitializer() { 125 return "<clinit>".equals(getMethodName()); 126 } 127 } 128 129 130 | Popular Tags |