1 10 11 package com.triactive.jdo.test; 12 13 import javax.jdo.JDOHelper; 14 15 16 public class ValueWidget extends Widget 17 { 18 private MapWidget owner = null; 19 private Integer key = null; 20 21 22 public ValueWidget() 23 { 24 } 25 26 27 public MapWidget getOwner() 28 { 29 return owner; 30 } 31 32 33 public Integer getKey() 34 { 35 return key; 36 } 37 38 39 public void setOwner(MapWidget owner) 40 { 41 this.owner = owner; 42 } 43 44 45 public void setKey(Integer key) 46 { 47 this.key = key; 48 } 49 50 51 62 63 public boolean compareTo(Object obj) 64 { 65 if (this == obj) 66 return true; 67 68 if (!(obj instanceof ValueWidget) || !super.compareTo(obj)) 69 return false; 70 71 ValueWidget w = (ValueWidget)obj; 72 73 return key == null ? (w.key == null) : key.equals(w.key); 74 } 75 76 77 83 84 public String toString() 85 { 86 StringBuffer s = new StringBuffer (super.toString()); 87 88 s.append(" owner = ").append(JDOHelper.getObjectId(owner)); 89 s.append('\n'); 90 s.append(" key = ").append(key); 91 s.append('\n'); 92 93 return s.toString(); 94 } 95 } 96 | Popular Tags |