1 package test.RPCDispatch; 2 3 8 public class Data { 9 10 private int field1; 12 private String field2; 13 private int field3; 14 15 18 public Data() {} 19 20 23 public Data(int field1, String field2, int field3) { 24 this.field1=field1; 25 this.field2=field2; 26 this.field3=field3; 27 } 28 29 32 public int getField1() { 33 return field1; 34 } 35 36 39 public void setField1 (int field1) { 40 this.field1=field1; 41 } 42 43 46 public String getField2() { 47 return field2; 48 } 49 50 53 public void setField2 (String field2) { 54 this.field2=field2; 55 } 56 57 60 public int getField3() { 61 return field3; 62 } 63 64 67 public void setField3 (int field3) { 68 this.field3=field3; 69 } 70 71 74 public boolean equals(Object object) { 75 if (!(object instanceof Data)) return false; 76 77 Data that= (Data) object; 78 79 if (this.field1 != that.field1) return false; 80 if (this.field3 != that.field3) return false; 81 82 if (this.field2 == null) { 83 if (that.field2 != null) return false; 84 } else { 85 if (!this.field2.equals(that.field2)) return false; 86 } 87 88 return true; 89 }; 90 } 91 | Popular Tags |