KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > common > validation > samples > simple > beans > ObjectEight


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /**
25  * This generated bean class ObjectEight matches the schema element object-eight
26  *
27  * Generated on Wed Aug 20 09:25:27 PDT 2003
28  */

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 // BEGIN_NOI18N
38

39 public class ObjectEight extends org.netbeans.modules.schema2beans.BaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc PROPERTY_ONE = "PropertyOne"; // NOI18N
45
static public final String JavaDoc PROPERTY_TWO = "PropertyTwo"; // NOI18N
46
static public final String JavaDoc CHILD_OBJECT_ONE = "ChildObjectOne"; // NOI18N
47
static public final String JavaDoc CHILD_OBJECT_TWO = "ChildObjectTwo"; // NOI18N
48
static public final String JavaDoc CHILD_OBJECT_THREE = "ChildObjectThree"; // NOI18N
49
static public final String JavaDoc CHILD_OBJECT_FOUR = "ChildObjectFour"; // NOI18N
50

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         // Properties (see root bean comments for the bean graph)
59
this.createProperty("property-one", // NOI18N
60
PROPERTY_ONE,
61             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
62             String JavaDoc.class);
63         this.createProperty("property-two", // NOI18N
64
PROPERTY_TWO,
65             Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
66             String JavaDoc.class);
67         this.createProperty("child-object-one", // NOI18N
68
CHILD_OBJECT_ONE,
69             Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
70             ChildObjectOne.class);
71         this.createProperty("child-object-two", // NOI18N
72
CHILD_OBJECT_TWO,
73             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
74             ChildObjectTwo.class);
75         this.createProperty("child-object-three", // NOI18N
76
CHILD_OBJECT_THREE,
77             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
78             ChildObjectThree.class);
79         this.createProperty("child-object-four", // NOI18N
80
CHILD_OBJECT_FOUR,
81             Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY,
82             ChildObjectFour.class);
83         this.initialize(options);
84     }
85
86     // Setting the default values of the properties
87
void initialize(int options)
88     {
89         
90     }
91
92     // This attribute is mandatory
93
public void setPropertyOne(String JavaDoc value) {
94         this.setValue(PROPERTY_ONE, value);
95     }
96
97     //
98
public String JavaDoc getPropertyOne() {
99         return (String JavaDoc)this.getValue(PROPERTY_ONE);
100     }
101
102     // This attribute is optional
103
public void setPropertyTwo(String JavaDoc value) {
104         this.setValue(PROPERTY_TWO, value);
105     }
106
107     //
108
public String JavaDoc getPropertyTwo() {
109         return (String JavaDoc)this.getValue(PROPERTY_TWO);
110     }
111
112     // This attribute is mandatory
113
public void setChildObjectOne(ChildObjectOne value) {
114         this.setValue(CHILD_OBJECT_ONE, value);
115     }
116
117     //
118
public ChildObjectOne getChildObjectOne() {
119         return (ChildObjectOne)this.getValue(CHILD_OBJECT_ONE);
120     }
121
122     // This attribute is optional
123
public void setChildObjectTwo(ChildObjectTwo value) {
124         this.setValue(CHILD_OBJECT_TWO, value);
125     }
126
127     //
128
public ChildObjectTwo getChildObjectTwo() {
129         return (ChildObjectTwo)this.getValue(CHILD_OBJECT_TWO);
130     }
131
132     // This attribute is an array, possibly empty
133
public void setChildObjectThree(int index, ChildObjectThree value) {
134         this.setValue(CHILD_OBJECT_THREE, index, value);
135     }
136
137     //
138
public ChildObjectThree getChildObjectThree(int index) {
139         return (ChildObjectThree)this.getValue(CHILD_OBJECT_THREE, index);
140     }
141
142     // This attribute is an array, possibly empty
143
public void setChildObjectThree(ChildObjectThree[] value) {
144         this.setValue(CHILD_OBJECT_THREE, value);
145     }
146
147     //
148
public ChildObjectThree[] getChildObjectThree() {
149         return (ChildObjectThree[])this.getValues(CHILD_OBJECT_THREE);
150     }
151
152     // Return the number of properties
153
public int sizeChildObjectThree() {
154         return this.size(CHILD_OBJECT_THREE);
155     }
156
157     // Add a new element returning its index in the list
158
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     //
163
// Remove an element using its reference
164
// Returns the index the element had in the list
165
//
166
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     // This attribute is an array containing at least one element
171
public void setChildObjectFour(int index, ChildObjectFour value) {
172         this.setValue(CHILD_OBJECT_FOUR, index, value);
173     }
174
175     //
176
public ChildObjectFour getChildObjectFour(int index) {
177         return (ChildObjectFour)this.getValue(CHILD_OBJECT_FOUR, index);
178     }
179
180     // This attribute is an array containing at least one element
181
public void setChildObjectFour(ChildObjectFour[] value) {
182         this.setValue(CHILD_OBJECT_FOUR, value);
183     }
184
185     //
186
public ChildObjectFour[] getChildObjectFour() {
187         return (ChildObjectFour[])this.getValues(CHILD_OBJECT_FOUR);
188     }
189
190     // Return the number of properties
191
public int sizeChildObjectFour() {
192         return this.size(CHILD_OBJECT_FOUR);
193     }
194
195     // Add a new element returning its index in the list
196
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     //
201
// Remove an element using its reference
202
// Returns the index the element had in the list
203
//
204
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     //
209
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
210         comparators.add(c);
211     }
212
213     //
214
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         // Validating property propertyOne
220
if (getPropertyOne() == null) {
221             throw new org.netbeans.modules.schema2beans.ValidateException("getPropertyOne() == null", "propertyOne", this); // NOI18N
222
}
223         // Validating property propertyTwo
224
if (getPropertyTwo() != null) {
225         }
226         // Validating property childObjectOne
227
if (getChildObjectOne() == null) {
228             throw new org.netbeans.modules.schema2beans.ValidateException("getChildObjectOne() == null", "childObjectOne", this); // NOI18N
229
}
230         getChildObjectOne().validate();
231         // Validating property childObjectTwo
232
if (getChildObjectTwo() != null) {
233             getChildObjectTwo().validate();
234         }
235         // Validating property childObjectThree
236
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         // Validating property childObjectFour
243
if (sizeChildObjectFour() == 0) {
244             throw new org.netbeans.modules.schema2beans.ValidateException("sizeChildObjectFour() == 0", "childObjectFour", this); // NOI18N
245
}
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     // Dump the content of this bean returning it as a String
255
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
256         String JavaDoc s;
257         Object JavaDoc o;
258         org.netbeans.modules.schema2beans.BaseBean n;
259         str.append(indent);
260         str.append("PropertyOne"); // NOI18N
261
str.append(indent+"\t"); // NOI18N
262
str.append("<"); // NOI18N
263
s = this.getPropertyOne();
264         str.append((s==null?"null":s.trim())); // NOI18N
265
str.append(">\n"); // NOI18N
266
this.dumpAttributes(PROPERTY_ONE, 0, str, indent);
267
268         str.append(indent);
269         str.append("PropertyTwo"); // NOI18N
270
str.append(indent+"\t"); // NOI18N
271
str.append("<"); // NOI18N
272
s = this.getPropertyTwo();
273         str.append((s==null?"null":s.trim())); // NOI18N
274
str.append(">\n"); // NOI18N
275
this.dumpAttributes(PROPERTY_TWO, 0, str, indent);
276
277         str.append(indent);
278         str.append("ChildObjectOne"); // NOI18N
279
n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectOne();
280         if (n != null)
281             n.dump(str, indent + "\t"); // NOI18N
282
else
283             str.append(indent+"\tnull"); // NOI18N
284
this.dumpAttributes(CHILD_OBJECT_ONE, 0, str, indent);
285
286         str.append(indent);
287         str.append("ChildObjectTwo"); // NOI18N
288
n = (org.netbeans.modules.schema2beans.BaseBean) this.getChildObjectTwo();
289         if (n != null)
290             n.dump(str, indent + "\t"); // NOI18N
291
else
292             str.append(indent+"\tnull"); // NOI18N
293
this.dumpAttributes(CHILD_OBJECT_TWO, 0, str, indent);
294
295         str.append(indent);
296         str.append("ChildObjectThree["+this.sizeChildObjectThree()+"]"); // NOI18N
297
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"); // NOI18N
304
else
305                 str.append(indent+"\tnull"); // NOI18N
306
this.dumpAttributes(CHILD_OBJECT_THREE, i, str, indent);
307         }
308
309         str.append(indent);
310         str.append("ChildObjectFour["+this.sizeChildObjectFour()+"]"); // NOI18N
311
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"); // NOI18N
318
else
319                 str.append(indent+"\tnull"); // NOI18N
320
this.dumpAttributes(CHILD_OBJECT_FOUR, i, str, indent);
321         }
322
323     }
324     public String JavaDoc dumpBeanNode(){
325         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
326         str.append("ObjectEight\n"); // NOI18N
327
this.dump(str, "\n "); // NOI18N
328
return str.toString();
329     }}
330
331 // END_NOI18N
332

333
334 /*
335         The following schema file has been used for generation:
336
337 <?xml version="1.0" encoding="UTF-8"?>
338 <!--
339     Document : sample.dtd
340     Created on : May 8, 2003, 11:18 AM
341     Author : Rajeshwar Patil
342     Description:
343         Purpose of the document follows.
344 -->
345
346 <!--
347 -->
348 <!ELEMENT root-element (non-zero-length-property, number-property+,
349     boolean-property*, range-property?, enumeration-property,
350     object-one, object-two?, object-three?, object-four,
351     object-five*, object-six+, object-seven*,object-eight*)>
352
353 <!--
354 -->
355 <!ELEMENT object-one (property-one, property-two?)>
356
357
358 <!--
359 -->
360 <!ELEMENT object-two (property-one, property-two)>
361
362
363 <!--
364 -->
365 <!ELEMENT object-three (property-one, property-two?,
366     property-three+, property-four*)>
367
368
369 <!--
370 -->
371 <!ELEMENT object-four (property-one?, property-two?)>
372
373
374 <!--
375 -->
376 <!ELEMENT object-five (property-one, property-two?)>
377
378
379 <!--
380 -->
381 <!ELEMENT object-six (property-one?, property-two?)>
382
383
384 <!--
385 -->
386 <!ELEMENT object-seven (property-one, property-two)>
387
388
389 <!--
390 -->
391 <!ELEMENT object-eight (property-one, property-two?, child-object-one,
392     child-object-two?, child-object-three*, child-object-four+)>
393
394
395 <!--
396 -->
397 <!ELEMENT child-object-one (property-one, property-two?)>
398
399
400 <!--
401 -->
402 <!ELEMENT child-object-two (property-one, property-two)>
403
404
405 <!--
406 -->
407 <!ELEMENT child-object-three (property-one?, property-two?)>
408
409
410 <!--
411 -->
412 <!ELEMENT child-object-four (property-one, property-two?,
413     property-three+, property-four*)>
414
415
416 <!ELEMENT boolean-property (#PCDATA)>
417 <!ELEMENT number-property (#PCDATA)>
418 <!ELEMENT non-zero-length-property (#PCDATA)>
419 <!ELEMENT range-property (#PCDATA)>
420 <!ELEMENT enumeration-property (#PCDATA)>
421 <!ELEMENT property-one (#PCDATA)>
422 <!ELEMENT property-two (#PCDATA)>
423 <!ELEMENT property-three (#PCDATA)>
424 <!ELEMENT property-four (#PCDATA)>
425
426 */

427
Popular Tags