1 7 34 35 package com.sun.tools.example.debug.bdi; 36 37 import com.sun.jdi.*; 38 import com.sun.jdi.request.*; 39 40 public abstract class WatchpointSpec extends EventRequestSpec { 41 final String fieldId; 42 43 WatchpointSpec(EventRequestSpecList specs, 44 ReferenceTypeSpec refSpec, String fieldId) { 45 super(specs, refSpec); 46 this.fieldId = fieldId; 47 } 51 52 void notifySet(SpecListener listener, SpecEvent evt) { 53 listener.watchpointSet(evt); 54 } 55 56 void notifyDeferred(SpecListener listener, SpecEvent evt) { 57 listener.watchpointDeferred(evt); 58 } 59 60 void notifyResolved(SpecListener listener, SpecEvent evt) { 61 listener.watchpointResolved(evt); 62 } 63 64 void notifyDeleted(SpecListener listener, SpecEvent evt) { 65 listener.watchpointDeleted(evt); 66 } 67 68 void notifyError(SpecListener listener, SpecErrorEvent evt) { 69 listener.watchpointError(evt); 70 } 71 72 public int hashCode() { 73 return refSpec.hashCode() + fieldId.hashCode() + 74 getClass().hashCode(); 75 } 76 77 public boolean equals(Object obj) { 78 if (obj instanceof WatchpointSpec) { 79 WatchpointSpec watchpoint = (WatchpointSpec)obj; 80 81 return fieldId.equals(watchpoint.fieldId) && 82 refSpec.equals(watchpoint.refSpec) && 83 getClass().equals(watchpoint.getClass()); 84 } else { 85 return false; 86 } 87 } 88 89 public String errorMessageFor(Exception e) { 90 if (e instanceof NoSuchFieldException ) { 91 return ("No field " + fieldId + " in " + refSpec); 92 } else { 93 return super.errorMessageFor(e); 94 } 95 } 96 } 97 98 99 | Popular Tags |