1 19 20 24 25 package org.netbeans.modules.j2ee.sun.validation.samples.simple.beans; 26 27 import org.w3c.dom.*; 28 import org.netbeans.modules.schema2beans.*; 29 import java.beans.*; 30 import java.util.*; 31 32 34 public class ObjectEight extends org.netbeans.modules.schema2beans.BaseBean 35 { 36 37 static Vector comparators = new Vector(); 38 39 static public final String PROPERTY_ONE = "PropertyOne"; static public final String PROPERTY_TWO = "PropertyTwo"; static public final String CHILD_OBJECT_ONE = "ChildObjectOne"; static public final String CHILD_OBJECT_TWO = "ChildObjectTwo"; static public final String CHILD_OBJECT_THREE = "ChildObjectThree"; static public final String CHILD_OBJECT_FOUR = "ChildObjectFour"; 46 public ObjectEight() { 47 this(Common.USE_DEFAULT_VALUES); 48 } 49 50 public ObjectEight(int options) 51 { 52 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 53 this.createProperty("property-one", PROPERTY_ONE, 56 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 57 String .class); 58 this.createProperty("property-two", PROPERTY_TWO, 60 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 61 String .class); 62 this.createProperty("child-object-one", CHILD_OBJECT_ONE, 64 Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 65 ChildObjectOne.class); 66 this.createProperty("child-object-two", CHILD_OBJECT_TWO, 68 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 69 ChildObjectTwo.class); 70 this.createProperty("child-object-three", CHILD_OBJECT_THREE, 72 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 73 ChildObjectThree.class); 74 this.createProperty("child-object-four", CHILD_OBJECT_FOUR, 76 Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY, 77 ChildObjectFour.class); 78 this.initialize(options); 79 } 80 81 void initialize(int options) 83 { 84 85 } 86 87 public void setPropertyOne(String value) { 89 this.setValue(PROPERTY_ONE, value); 90 } 91 92 public String getPropertyOne() { 94 return (String )this.getValue(PROPERTY_ONE); 95 } 96 97 public void setPropertyTwo(String value) { 99 this.setValue(PROPERTY_TWO, value); 100 } 101 102 public String getPropertyTwo() { 104 return (String )this.getValue(PROPERTY_TWO); 105 } 106 107 public void setChildObjectOne(ChildObjectOne value) { 109 this.setValue(CHILD_OBJECT_ONE, value); 110 } 111 112 public ChildObjectOne getChildObjectOne() { 114 return (ChildObjectOne)this.getValue(CHILD_OBJECT_ONE); 115 } 116 117 public void setChildObjectTwo(ChildObjectTwo value) { 119 this.setValue(CHILD_OBJECT_TWO, value); 120 } 121 122 public ChildObjectTwo getChildObjectTwo() { 124 return (ChildObjectTwo)this.getValue(CHILD_OBJECT_TWO); 125 } 126 127 public void setChildObjectThree(int index, ChildObjectThree value) { 129 this.setValue(CHILD_OBJECT_THREE, index, value); 130 } 131 132 public ChildObjectThree getChildObjectThree(int index) { 134 return (ChildObjectThree)this.getValue(CHILD_OBJECT_THREE, index); 135 } 136 137 public void setChildObjectThree(ChildObjectThree[] value) { 139 this.setValue(CHILD_OBJECT_THREE, value); 140 } 141 142 public ChildObjectThree[] getChildObjectThree() { 144 return (ChildObjectThree[])this.getValues(CHILD_OBJECT_THREE); 145 } 146 147 public int sizeChildObjectThree() { 149 return this.size(CHILD_OBJECT_THREE); 150 } 151 152 public int addChildObjectThree(org.netbeans.modules.j2ee.sun.validation.samples.simple.beans.ChildObjectThree value) { 154 return this.addValue(CHILD_OBJECT_THREE, value); 155 } 156 157 public int removeChildObjectThree(org.netbeans.modules.j2ee.sun.validation.samples.simple.beans.ChildObjectThree value) { 162 return this.removeValue(CHILD_OBJECT_THREE, value); 163 } 164 165 public void setChildObjectFour(int index, ChildObjectFour value) { 167 this.setValue(CHILD_OBJECT_FOUR, index, value); 168 } 169 170 public ChildObjectFour getChildObjectFour(int index) { 172 return (ChildObjectFour)this.getValue(CHILD_OBJECT_FOUR, index); 173 } 174 175 public void setChildObjectFour(ChildObjectFour[] value) { 177 this.setValue(CHILD_OBJECT_FOUR, value); 178 } 179 180 public ChildObjectFour[] getChildObjectFour() { 182 return (ChildObjectFour[])this.getValues(CHILD_OBJECT_FOUR); 183 } 184 185 public int sizeChildObjectFour() { 187 return this.size(CHILD_OBJECT_FOUR); 188 } 189 190 public int addChildObjectFour(org.netbeans.modules.j2ee.sun.validation.samples.simple.beans.ChildObjectFour value) { 192 return this.addValue(CHILD_OBJECT_FOUR, value); 193 } 194 195 public int removeChildObjectFour(org.netbeans.modules.j2ee.sun.validation.samples.simple.beans.ChildObjectFour value) { 200 return this.removeValue(CHILD_OBJECT_FOUR, value); 201 } 202 203 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 205 comparators.add(c); 206 } 207 208 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 210 comparators.remove(c); 211 } 212 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 213 boolean restrictionFailure = false; 214 if (getPropertyOne() == null) { 216 throw new org.netbeans.modules.schema2beans.ValidateException("getPropertyOne() == null", "propertyOne", this); } 218 if (getPropertyTwo() != null) { 220 } 221 if (getChildObjectOne() == null) { 223 throw new org.netbeans.modules.schema2beans.ValidateException("getChildObjectOne() == null", "childObjectOne", this); } 225 getChildObjectOne().validate(); 226 if (getChildObjectTwo() != null) { 228 getChildObjectTwo().validate(); 229 } 230 for (int _index = 0; _index < sizeChildObjectThree(); ++_index) { 232 org.netbeans.modules.j2ee.sun.validation.samples.simple.beans.ChildObjectThree element = getChildObjectThree(_index); 233 if (element != null) { 234 element.validate(); 235 } 236 } 237 if (sizeChildObjectFour() == 0) { 239 throw new org.netbeans.modules.schema2beans.ValidateException("sizeChildObjectFour() == 0", "childObjectFour", this); } 241 for (int _index = 0; _index < sizeChildObjectFour(); ++_index) { 242 org.netbeans.modules.j2ee.sun.validation.samples.simple.beans.ChildObjectFour element = getChildObjectFour(_index); 243 if (element != null) { 244 element.validate(); 245 } 246 } 247 } 248 249 public void dump(StringBuffer str, String indent){ 251 String s; 252 Object o; 253 org.netbeans.modules.schema2beans.BaseBean n; 254 str.append(indent); 255 str.append("PropertyOne"); str.append(indent+"\t"); str.append("<"); s = this.getPropertyOne(); 259 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_ONE, 0, str, indent); 262 263 str.append(indent); 264 str.append("PropertyTwo"); str.append(indent+"\t"); str.append("<"); s = this.getPropertyTwo(); 268 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_TWO, 0, str, indent); 271 272 str.append(indent); 273 str.append("ChildObjectOne"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectOne(); 275 if (n != null) 276 n.dump(str, indent + "\t"); else 278 str.append(indent+"\tnull"); this.dumpAttributes(CHILD_OBJECT_ONE, 0, str, indent); 280 281 str.append(indent); 282 str.append("ChildObjectTwo"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectTwo(); 284 if (n != null) 285 n.dump(str, indent + "\t"); else 287 str.append(indent+"\tnull"); this.dumpAttributes(CHILD_OBJECT_TWO, 0, str, indent); 289 290 str.append(indent); 291 str.append("ChildObjectThree["+this.sizeChildObjectThree()+"]"); for(int i=0; i<this.sizeChildObjectThree(); i++) 293 { 294 str.append(indent+"\t"); 295 str.append("#"+i+":"); 296 n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectThree(i); 297 if (n != null) 298 n.dump(str, indent + "\t"); else 300 str.append(indent+"\tnull"); this.dumpAttributes(CHILD_OBJECT_THREE, i, str, indent); 302 } 303 304 str.append(indent); 305 str.append("ChildObjectFour["+this.sizeChildObjectFour()+"]"); for(int i=0; i<this.sizeChildObjectFour(); i++) 307 { 308 str.append(indent+"\t"); 309 str.append("#"+i+":"); 310 n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectFour(i); 311 if (n != null) 312 n.dump(str, indent + "\t"); else 314 str.append(indent+"\tnull"); this.dumpAttributes(CHILD_OBJECT_FOUR, i, str, indent); 316 } 317 318 } 319 public String dumpBeanNode(){ 320 StringBuffer str = new StringBuffer (); 321 str.append("ObjectEight\n"); this.dump(str, "\n "); return str.toString(); 324 }} 325 326 328 329 422 | Popular Tags |