1 23 24 29 30 package com.sun.enterprise.tools.common.validation.samples.simple.beans; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 39 public class ObjectEight extends org.netbeans.modules.schema2beans.BaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 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"; 51 public ObjectEight() { 52 this(Common.USE_DEFAULT_VALUES); 53 } 54 55 public ObjectEight(int options) 56 { 57 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 58 this.createProperty("property-one", PROPERTY_ONE, 61 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 62 String .class); 63 this.createProperty("property-two", PROPERTY_TWO, 65 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 66 String .class); 67 this.createProperty("child-object-one", CHILD_OBJECT_ONE, 69 Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 70 ChildObjectOne.class); 71 this.createProperty("child-object-two", CHILD_OBJECT_TWO, 73 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 74 ChildObjectTwo.class); 75 this.createProperty("child-object-three", CHILD_OBJECT_THREE, 77 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 78 ChildObjectThree.class); 79 this.createProperty("child-object-four", CHILD_OBJECT_FOUR, 81 Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY, 82 ChildObjectFour.class); 83 this.initialize(options); 84 } 85 86 void initialize(int options) 88 { 89 90 } 91 92 public void setPropertyOne(String value) { 94 this.setValue(PROPERTY_ONE, value); 95 } 96 97 public String getPropertyOne() { 99 return (String )this.getValue(PROPERTY_ONE); 100 } 101 102 public void setPropertyTwo(String value) { 104 this.setValue(PROPERTY_TWO, value); 105 } 106 107 public String getPropertyTwo() { 109 return (String )this.getValue(PROPERTY_TWO); 110 } 111 112 public void setChildObjectOne(ChildObjectOne value) { 114 this.setValue(CHILD_OBJECT_ONE, value); 115 } 116 117 public ChildObjectOne getChildObjectOne() { 119 return (ChildObjectOne)this.getValue(CHILD_OBJECT_ONE); 120 } 121 122 public void setChildObjectTwo(ChildObjectTwo value) { 124 this.setValue(CHILD_OBJECT_TWO, value); 125 } 126 127 public ChildObjectTwo getChildObjectTwo() { 129 return (ChildObjectTwo)this.getValue(CHILD_OBJECT_TWO); 130 } 131 132 public void setChildObjectThree(int index, ChildObjectThree value) { 134 this.setValue(CHILD_OBJECT_THREE, index, value); 135 } 136 137 public ChildObjectThree getChildObjectThree(int index) { 139 return (ChildObjectThree)this.getValue(CHILD_OBJECT_THREE, index); 140 } 141 142 public void setChildObjectThree(ChildObjectThree[] value) { 144 this.setValue(CHILD_OBJECT_THREE, value); 145 } 146 147 public ChildObjectThree[] getChildObjectThree() { 149 return (ChildObjectThree[])this.getValues(CHILD_OBJECT_THREE); 150 } 151 152 public int sizeChildObjectThree() { 154 return this.size(CHILD_OBJECT_THREE); 155 } 156 157 public int addChildObjectThree(com.sun.enterprise.tools.common.validation.samples.simple.beans.ChildObjectThree value) { 159 return this.addValue(CHILD_OBJECT_THREE, value); 160 } 161 162 public int removeChildObjectThree(com.sun.enterprise.tools.common.validation.samples.simple.beans.ChildObjectThree value) { 167 return this.removeValue(CHILD_OBJECT_THREE, value); 168 } 169 170 public void setChildObjectFour(int index, ChildObjectFour value) { 172 this.setValue(CHILD_OBJECT_FOUR, index, value); 173 } 174 175 public ChildObjectFour getChildObjectFour(int index) { 177 return (ChildObjectFour)this.getValue(CHILD_OBJECT_FOUR, index); 178 } 179 180 public void setChildObjectFour(ChildObjectFour[] value) { 182 this.setValue(CHILD_OBJECT_FOUR, value); 183 } 184 185 public ChildObjectFour[] getChildObjectFour() { 187 return (ChildObjectFour[])this.getValues(CHILD_OBJECT_FOUR); 188 } 189 190 public int sizeChildObjectFour() { 192 return this.size(CHILD_OBJECT_FOUR); 193 } 194 195 public int addChildObjectFour(com.sun.enterprise.tools.common.validation.samples.simple.beans.ChildObjectFour value) { 197 return this.addValue(CHILD_OBJECT_FOUR, value); 198 } 199 200 public int removeChildObjectFour(com.sun.enterprise.tools.common.validation.samples.simple.beans.ChildObjectFour value) { 205 return this.removeValue(CHILD_OBJECT_FOUR, value); 206 } 207 208 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 210 comparators.add(c); 211 } 212 213 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 215 comparators.remove(c); 216 } 217 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 218 boolean restrictionFailure = false; 219 if (getPropertyOne() == null) { 221 throw new org.netbeans.modules.schema2beans.ValidateException("getPropertyOne() == null", "propertyOne", this); } 223 if (getPropertyTwo() != null) { 225 } 226 if (getChildObjectOne() == null) { 228 throw new org.netbeans.modules.schema2beans.ValidateException("getChildObjectOne() == null", "childObjectOne", this); } 230 getChildObjectOne().validate(); 231 if (getChildObjectTwo() != null) { 233 getChildObjectTwo().validate(); 234 } 235 for (int _index = 0; _index < sizeChildObjectThree(); ++_index) { 237 com.sun.enterprise.tools.common.validation.samples.simple.beans.ChildObjectThree element = getChildObjectThree(_index); 238 if (element != null) { 239 element.validate(); 240 } 241 } 242 if (sizeChildObjectFour() == 0) { 244 throw new org.netbeans.modules.schema2beans.ValidateException("sizeChildObjectFour() == 0", "childObjectFour", this); } 246 for (int _index = 0; _index < sizeChildObjectFour(); ++_index) { 247 com.sun.enterprise.tools.common.validation.samples.simple.beans.ChildObjectFour element = getChildObjectFour(_index); 248 if (element != null) { 249 element.validate(); 250 } 251 } 252 } 253 254 public void dump(StringBuffer str, String indent){ 256 String s; 257 Object o; 258 org.netbeans.modules.schema2beans.BaseBean n; 259 str.append(indent); 260 str.append("PropertyOne"); str.append(indent+"\t"); str.append("<"); s = this.getPropertyOne(); 264 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_ONE, 0, str, indent); 267 268 str.append(indent); 269 str.append("PropertyTwo"); str.append(indent+"\t"); str.append("<"); s = this.getPropertyTwo(); 273 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_TWO, 0, str, indent); 276 277 str.append(indent); 278 str.append("ChildObjectOne"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectOne(); 280 if (n != null) 281 n.dump(str, indent + "\t"); else 283 str.append(indent+"\tnull"); this.dumpAttributes(CHILD_OBJECT_ONE, 0, str, indent); 285 286 str.append(indent); 287 str.append("ChildObjectTwo"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectTwo(); 289 if (n != null) 290 n.dump(str, indent + "\t"); else 292 str.append(indent+"\tnull"); this.dumpAttributes(CHILD_OBJECT_TWO, 0, str, indent); 294 295 str.append(indent); 296 str.append("ChildObjectThree["+this.sizeChildObjectThree()+"]"); for(int i=0; i<this.sizeChildObjectThree(); i++) 298 { 299 str.append(indent+"\t"); 300 str.append("#"+i+":"); 301 n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectThree(i); 302 if (n != null) 303 n.dump(str, indent + "\t"); else 305 str.append(indent+"\tnull"); this.dumpAttributes(CHILD_OBJECT_THREE, i, str, indent); 307 } 308 309 str.append(indent); 310 str.append("ChildObjectFour["+this.sizeChildObjectFour()+"]"); for(int i=0; i<this.sizeChildObjectFour(); i++) 312 { 313 str.append(indent+"\t"); 314 str.append("#"+i+":"); 315 n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectFour(i); 316 if (n != null) 317 n.dump(str, indent + "\t"); else 319 str.append(indent+"\tnull"); this.dumpAttributes(CHILD_OBJECT_FOUR, i, str, indent); 321 } 322 323 } 324 public String dumpBeanNode(){ 325 StringBuffer str = new StringBuffer (); 326 str.append("ObjectEight\n"); this.dump(str, "\n "); return str.toString(); 329 }} 330 331 333 334 427 | Popular Tags |