1 7 8 package javax.naming; 9 10 35 36 40 41 public abstract class RefAddr implements java.io.Serializable { 42 46 protected String addrType; 47 48 53 protected RefAddr(String addrType) { 54 this.addrType = addrType; 55 } 56 57 62 public String getType() { 63 return addrType; 64 } 65 66 71 public abstract Object getContent(); 72 73 88 public boolean equals(Object obj) { 89 if ((obj != null) && (obj instanceof RefAddr )) { 90 RefAddr target = (RefAddr )obj; 91 if (addrType.compareTo(target.addrType) == 0) { 92 Object thisobj = this.getContent(); 93 Object thatobj = target.getContent(); 94 if (thisobj == thatobj) 95 return true; 96 if (thisobj != null) 97 return thisobj.equals(thatobj); 98 } 99 } 100 return false; 101 } 102 103 111 public int hashCode() { 112 return (getContent() == null) 113 ? addrType.hashCode() 114 : addrType.hashCode() + getContent().hashCode(); 115 } 116 117 123 public String toString(){ 124 StringBuffer str = new StringBuffer ("Type: " + addrType + "\n"); 125 126 str.append("Content: " + getContent() + "\n"); 127 return (str.toString()); 128 } 129 130 133 private static final long serialVersionUID = -1468165120479154358L; 134 } 135 | Popular Tags |