1 27 package ch.ethz.prose.engine; 28 29 import java.lang.reflect.Field ; 31 32 33 import ch.ethz.jvmai.JVMAspectInterface; 34 import ch.ethz.jvmai.JoinPointKinds; 35 import ch.ethz.jvmai.ClassSpecific; 36 37 49 public class FieldModificationRequest extends JoinPointRequest implements JoinPointKinds,ClassSpecific { 50 51 private final Field field; 52 private final Class fieldClass; 53 54 59 protected FieldModificationRequest() 60 { 61 super(null); 62 field = null; 63 fieldClass = null; 64 } 65 66 public String getKind() 67 { 68 return KIND_FIELD_MODIFICATION_JP; 69 } 70 71 public int getMask() 72 { 73 return MASK_FIELD_MODIFICATION_JP; 74 } 75 76 83 public FieldModificationRequest(Field f,JoinPointManager o) 84 { 85 super(o); 86 field = f; 87 fieldClass = field.getDeclaringClass(); 88 } 89 90 93 public Class getTargetClass() 94 { 95 return fieldClass; 96 } 97 98 101 public Field getField() 102 { 103 return field; 104 } 105 106 protected void setWatch(Object listeners) 107 { 108 owner.getAspectInterface().setFieldModificationWatch(field,listeners); 109 } 110 111 protected void clearWatch() 112 { 113 owner.getAspectInterface().clearFieldModificationWatch(field); 114 } 115 116 public boolean equals(Object other) 117 { 118 FieldModificationRequest otherReq; 119 if (other instanceof FieldModificationRequest) 120 otherReq = (FieldModificationRequest)other; 121 else 122 return false; 123 return field.equals(otherReq.field); 124 } 125 126 public int hashCode() 127 { 128 return field.hashCode(); 129 } 130 131 public String toString() 132 { 133 return "FieldModificationRequest on " + fieldClass.getName() + "." + field.getName(); 134 } 135 136 } 137 138 139 | Popular Tags |