1 27 package ch.ethz.prose.engine; 28 29 import java.lang.reflect.Method ; 31 32 import ch.ethz.jvmai.JVMAspectInterface; 33 import ch.ethz.jvmai.JoinPointKinds; 34 import ch.ethz.jvmai.ClassSpecific; 35 36 47 public 48 class MethodEntryRequest extends JoinPointRequest implements JoinPointKinds,ClassSpecific { 49 50 private final Method method; 51 private final Class methodClass; 52 53 public int getMask() 54 { 55 return MASK_METHOD_ENTRY_JP| MASK_CODE_JP; 56 } 57 58 public String getKind() 59 { 60 return KIND_METHOD_ENTRY_JP; 61 } 62 63 70 public MethodEntryRequest(Method m,JoinPointManager o) 71 { 72 super(o); 73 method = m; 74 methodClass = method.getDeclaringClass(); 75 } 76 77 80 public Class getTargetClass() 81 { 82 return methodClass; 83 } 84 85 88 public Method getMethod() 89 { 90 return method; 91 } 92 93 protected void setWatch(Object listeners) 94 { 95 owner.getAspectInterface().setMethodEntryWatch(method,listeners); 96 } 97 98 protected void clearWatch() 99 { 100 owner.getAspectInterface().clearMethodEntryWatch(method); 101 } 102 103 public boolean equals(Object other) 104 { 105 MethodEntryRequest otherReq; 106 if (other instanceof MethodEntryRequest) 107 otherReq = (MethodEntryRequest)other; 108 else 109 return false; 110 return method.equals(otherReq.method); 111 } 112 113 public int hashCode() 116 { 117 return (getMethod().hashCode() + 1); 118 } 119 120 public String toString() 121 { 122 return "MethodEntryRequest on " + methodClass.getName() + "." + method.getName(); 123 } 124 125 126 } 127 128 129 | Popular Tags |