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 46 public 47 class MethodExitRequest extends JoinPointRequest implements JoinPointKinds,ClassSpecific { 48 49 private final Method method; 50 private final Class methodClass; 51 52 public String getKind() 53 { 54 return KIND_METHOD_EXIT_JP; 55 } 56 57 64 public MethodExitRequest(Method m, JoinPointManager o) 65 { 66 super(o); 67 method = m; 68 methodClass = method.getDeclaringClass(); 69 } 70 71 public int getMask() 72 { 73 return MASK_METHOD_EXIT_JP| MASK_CODE_JP; 74 } 75 76 79 public Class getTargetClass() 80 { 81 return methodClass; 82 } 83 84 87 public Method getMethod() 88 { 89 return method; 90 } 91 92 protected void setWatch(Object listeners) 93 { 94 owner.getAspectInterface().setMethodExitWatch(method,listeners); 95 } 96 97 protected void clearWatch() 98 { 99 owner.getAspectInterface().clearMethodExitWatch(method); 100 } 101 102 public boolean equals(Object other) 103 { 104 MethodExitRequest otherReq; 105 if (other instanceof MethodExitRequest) 106 otherReq = (MethodExitRequest)other; 107 else 108 return false; 109 return method.equals(otherReq.method); 110 } 111 112 public int hashCode() 113 { 114 return getMethod().hashCode(); 115 } 116 117 public String toString() 118 { 119 return "MethodExitReuest on " + methodClass.getName() + "." + method.getName(); 120 } 121 122 } 123 124 125 | Popular Tags |