KickJava   Java API By Example, From Geeks To Geeks.

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


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 RootElement matches the schema element root-element
26  *
27  * Generated on Wed Aug 20 09:25:27 PDT 2003
28  *
29  * This class matches the root element of the DTD,
30  * and is the root of the following bean graph:
31  *
32  * root-element : RootElement
33  * non-zero-length-property : String
34  * number-property : String[1,n]
35  * boolean-property : String[0,n]
36  * range-property : String?
37  * enumeration-property : String
38  * object-one : ObjectOne
39  * property-one : String
40  * property-two : String?
41  * object-two : ObjectTwo?
42  * property-one : String
43  * property-two : String
44  * object-three : ObjectThree?
45  * property-one : String
46  * property-two : String?
47  * property-three : String[1,n]
48  * property-four : String[0,n]
49  * object-four : ObjectFour
50  * property-one : String?
51  * property-two : String?
52  * object-five : ObjectFive[0,n]
53  * property-one : String
54  * property-two : String?
55  * object-six : ObjectSix[1,n]
56  * property-one : String?
57  * property-two : String?
58  * object-seven : ObjectSeven[0,n]
59  * property-one : String
60  * property-two : String
61  * object-eight : ObjectEight[0,n]
62  * property-one : String
63  * property-two : String?
64  * child-object-one : ChildObjectOne
65  * property-one : String
66  * property-two : String?
67  * child-object-two : ChildObjectTwo?
68  * property-one : String
69  * property-two : String
70  * child-object-three : ChildObjectThree[0,n]
71  * property-one : String?
72  * property-two : String?
73  * child-object-four : ChildObjectFour[1,n]
74  * property-one : String
75  * property-two : String?
76  * property-three : String[1,n]
77  * property-four : String[0,n]
78  *
79  */

80
81 package com.sun.enterprise.tools.common.validation.samples.simple.beans;
82
83 import org.w3c.dom.*;
84 import org.netbeans.modules.schema2beans.*;
85 import java.beans.*;
86 import java.util.*;
87 import java.io.*;
88
89 // BEGIN_NOI18N
90

91 public class RootElement extends org.netbeans.modules.schema2beans.BaseBean
92 {
93
94     static Vector comparators = new Vector();
95
96     static public final String JavaDoc NON_ZERO_LENGTH_PROPERTY = "NonZeroLengthProperty"; // NOI18N
97
static public final String JavaDoc NUMBER_PROPERTY = "NumberProperty"; // NOI18N
98
static public final String JavaDoc BOOLEAN_PROPERTY = "BooleanProperty"; // NOI18N
99
static public final String JavaDoc RANGE_PROPERTY = "RangeProperty"; // NOI18N
100
static public final String JavaDoc ENUMERATION_PROPERTY = "EnumerationProperty"; // NOI18N
101
static public final String JavaDoc OBJECT_ONE = "ObjectOne"; // NOI18N
102
static public final String JavaDoc OBJECT_TWO = "ObjectTwo"; // NOI18N
103
static public final String JavaDoc OBJECT_THREE = "ObjectThree"; // NOI18N
104
static public final String JavaDoc OBJECT_FOUR = "ObjectFour"; // NOI18N
105
static public final String JavaDoc OBJECT_FIVE = "ObjectFive"; // NOI18N
106
static public final String JavaDoc OBJECT_SIX = "ObjectSix"; // NOI18N
107
static public final String JavaDoc OBJECT_SEVEN = "ObjectSeven"; // NOI18N
108
static public final String JavaDoc OBJECT_EIGHT = "ObjectEight"; // NOI18N
109

110     public RootElement() throws org.netbeans.modules.schema2beans.Schema2BeansException {
111         this(null, Common.USE_DEFAULT_VALUES);
112     }
113
114     public RootElement(org.w3c.dom.Node JavaDoc doc, int options) throws org.netbeans.modules.schema2beans.Schema2BeansException {
115         this(Common.NO_DEFAULT_VALUES);
116         initFromNode(doc, options);
117     }
118     protected void initFromNode(org.w3c.dom.Node JavaDoc doc, int options) throws Schema2BeansException
119     {
120         if (doc == null)
121         {
122             doc = GraphManager.createRootElementNode("root-element"); // NOI18N
123
if (doc == null)
124                 throw new Schema2BeansException(Common.getMessage(
125                     "CantCreateDOMRoot_msg", "root-element"));
126         }
127         Node n = GraphManager.getElementNode("root-element", doc); // NOI18N
128
if (n == null)
129             throw new Schema2BeansException(Common.getMessage(
130                 "DocRootNotInDOMGraph_msg", "root-element", doc.getFirstChild().getNodeName()));
131
132         this.graphManager.setXmlDocument(doc);
133
134         // Entry point of the createBeans() recursive calls
135
this.createBean(n, this.graphManager());
136         this.initialize(options);
137     }
138     public RootElement(int options)
139     {
140         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
141         initOptions(options);
142     }
143     protected void initOptions(int options)
144     {
145         // The graph manager is allocated in the bean root
146
this.graphManager = new GraphManager(this);
147         this.createRoot("root-element", "RootElement", // NOI18N
148
Common.TYPE_1 | Common.TYPE_BEAN, RootElement.class);
149
150         // Properties (see root bean comments for the bean graph)
151
this.createProperty("non-zero-length-property", // NOI18N
152
NON_ZERO_LENGTH_PROPERTY,
153             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
154             String JavaDoc.class);
155         this.createProperty("number-property", // NOI18N
156
NUMBER_PROPERTY,
157             Common.TYPE_1_N | Common.TYPE_STRING | Common.TYPE_KEY,
158             String JavaDoc.class);
159         this.createProperty("boolean-property", // NOI18N
160
BOOLEAN_PROPERTY,
161             Common.TYPE_0_N | Common.TYPE_STRING | Common.TYPE_KEY,
162             String JavaDoc.class);
163         this.createProperty("range-property", // NOI18N
164
RANGE_PROPERTY,
165             Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
166             String JavaDoc.class);
167         this.createProperty("enumeration-property", // NOI18N
168
ENUMERATION_PROPERTY,
169             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
170             String JavaDoc.class);
171         this.createProperty("object-one", // NOI18N
172
OBJECT_ONE,
173             Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
174             ObjectOne.class);
175         this.createProperty("object-two", // NOI18N
176
OBJECT_TWO,
177             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
178             ObjectTwo.class);
179         this.createProperty("object-three", // NOI18N
180
OBJECT_THREE,
181             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
182             ObjectThree.class);
183         this.createProperty("object-four", // NOI18N
184
OBJECT_FOUR,
185             Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
186             ObjectFour.class);
187         this.createProperty("object-five", // NOI18N
188
OBJECT_FIVE,
189             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
190             ObjectFive.class);
191         this.createProperty("object-six", // NOI18N
192
OBJECT_SIX,
193             Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY,
194             ObjectSix.class);
195         this.createProperty("object-seven", // NOI18N
196
OBJECT_SEVEN,
197             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
198             ObjectSeven.class);
199         this.createProperty("object-eight", // NOI18N
200
OBJECT_EIGHT,
201             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
202             ObjectEight.class);
203         this.initialize(options);
204     }
205
206     // Setting the default values of the properties
207
void initialize(int options)
208     {
209                     
210     }
211
212     // This attribute is mandatory
213
public void setNonZeroLengthProperty(String JavaDoc value) {
214         this.setValue(NON_ZERO_LENGTH_PROPERTY, value);
215     }
216
217     //
218
public String JavaDoc getNonZeroLengthProperty() {
219         return (String JavaDoc)this.getValue(NON_ZERO_LENGTH_PROPERTY);
220     }
221
222     // This attribute is an array containing at least one element
223
public void setNumberProperty(int index, String JavaDoc value) {
224         this.setValue(NUMBER_PROPERTY, index, value);
225     }
226
227     //
228
public String JavaDoc getNumberProperty(int index) {
229         return (String JavaDoc)this.getValue(NUMBER_PROPERTY, index);
230     }
231
232     // This attribute is an array containing at least one element
233
public void setNumberProperty(String JavaDoc[] value) {
234         this.setValue(NUMBER_PROPERTY, value);
235     }
236
237     //
238
public String JavaDoc[] getNumberProperty() {
239         return (String JavaDoc[])this.getValues(NUMBER_PROPERTY);
240     }
241
242     // Return the number of properties
243
public int sizeNumberProperty() {
244         return this.size(NUMBER_PROPERTY);
245     }
246
247     // Add a new element returning its index in the list
248
public int addNumberProperty(String JavaDoc value) {
249         return this.addValue(NUMBER_PROPERTY, value);
250     }
251
252     //
253
// Remove an element using its reference
254
// Returns the index the element had in the list
255
//
256
public int removeNumberProperty(String JavaDoc value) {
257         return this.removeValue(NUMBER_PROPERTY, value);
258     }
259
260     // This attribute is an array, possibly empty
261
public void setBooleanProperty(int index, String JavaDoc value) {
262         this.setValue(BOOLEAN_PROPERTY, index, value);
263     }
264
265     //
266
public String JavaDoc getBooleanProperty(int index) {
267         return (String JavaDoc)this.getValue(BOOLEAN_PROPERTY, index);
268     }
269
270     // This attribute is an array, possibly empty
271
public void setBooleanProperty(String JavaDoc[] value) {
272         this.setValue(BOOLEAN_PROPERTY, value);
273     }
274
275     //
276
public String JavaDoc[] getBooleanProperty() {
277         return (String JavaDoc[])this.getValues(BOOLEAN_PROPERTY);
278     }
279
280     // Return the number of properties
281
public int sizeBooleanProperty() {
282         return this.size(BOOLEAN_PROPERTY);
283     }
284
285     // Add a new element returning its index in the list
286
public int addBooleanProperty(String JavaDoc value) {
287         return this.addValue(BOOLEAN_PROPERTY, value);
288     }
289
290     //
291
// Remove an element using its reference
292
// Returns the index the element had in the list
293
//
294
public int removeBooleanProperty(String JavaDoc value) {
295         return this.removeValue(BOOLEAN_PROPERTY, value);
296     }
297
298     // This attribute is optional
299
public void setRangeProperty(String JavaDoc value) {
300         this.setValue(RANGE_PROPERTY, value);
301     }
302
303     //
304
public String JavaDoc getRangeProperty() {
305         return (String JavaDoc)this.getValue(RANGE_PROPERTY);
306     }
307
308     // This attribute is mandatory
309
public void setEnumerationProperty(String JavaDoc value) {
310         this.setValue(ENUMERATION_PROPERTY, value);
311     }
312
313     //
314
public String JavaDoc getEnumerationProperty() {
315         return (String JavaDoc)this.getValue(ENUMERATION_PROPERTY);
316     }
317
318     // This attribute is mandatory
319
public void setObjectOne(ObjectOne value) {
320         this.setValue(OBJECT_ONE, value);
321     }
322
323     //
324
public ObjectOne getObjectOne() {
325         return (ObjectOne)this.getValue(OBJECT_ONE);
326     }
327
328     // This attribute is optional
329
public void setObjectTwo(ObjectTwo value) {
330         this.setValue(OBJECT_TWO, value);
331     }
332
333     //
334
public ObjectTwo getObjectTwo() {
335         return (ObjectTwo)this.getValue(OBJECT_TWO);
336     }
337
338     // This attribute is optional
339
public void setObjectThree(ObjectThree value) {
340         this.setValue(OBJECT_THREE, value);
341     }
342
343     //
344
public ObjectThree getObjectThree() {
345         return (ObjectThree)this.getValue(OBJECT_THREE);
346     }
347
348     // This attribute is mandatory
349
public void setObjectFour(ObjectFour value) {
350         this.setValue(OBJECT_FOUR, value);
351     }
352
353     //
354
public ObjectFour getObjectFour() {
355         return (ObjectFour)this.getValue(OBJECT_FOUR);
356     }
357
358     // This attribute is an array, possibly empty
359
public void setObjectFive(int index, ObjectFive value) {
360         this.setValue(OBJECT_FIVE, index, value);
361     }
362
363     //
364
public ObjectFive getObjectFive(int index) {
365         return (ObjectFive)this.getValue(OBJECT_FIVE, index);
366     }
367
368     // This attribute is an array, possibly empty
369
public void setObjectFive(ObjectFive[] value) {
370         this.setValue(OBJECT_FIVE, value);
371     }
372
373     //
374
public ObjectFive[] getObjectFive() {
375         return (ObjectFive[])this.getValues(OBJECT_FIVE);
376     }
377
378     // Return the number of properties
379
public int sizeObjectFive() {
380         return this.size(OBJECT_FIVE);
381     }
382
383     // Add a new element returning its index in the list
384
public int addObjectFive(com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectFive value) {
385         return this.addValue(OBJECT_FIVE, value);
386     }
387
388     //
389
// Remove an element using its reference
390
// Returns the index the element had in the list
391
//
392
public int removeObjectFive(com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectFive value) {
393         return this.removeValue(OBJECT_FIVE, value);
394     }
395
396     // This attribute is an array containing at least one element
397
public void setObjectSix(int index, ObjectSix value) {
398         this.setValue(OBJECT_SIX, index, value);
399     }
400
401     //
402
public ObjectSix getObjectSix(int index) {
403         return (ObjectSix)this.getValue(OBJECT_SIX, index);
404     }
405
406     // This attribute is an array containing at least one element
407
public void setObjectSix(ObjectSix[] value) {
408         this.setValue(OBJECT_SIX, value);
409     }
410
411     //
412
public ObjectSix[] getObjectSix() {
413         return (ObjectSix[])this.getValues(OBJECT_SIX);
414     }
415
416     // Return the number of properties
417
public int sizeObjectSix() {
418         return this.size(OBJECT_SIX);
419     }
420
421     // Add a new element returning its index in the list
422
public int addObjectSix(com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectSix value) {
423         return this.addValue(OBJECT_SIX, value);
424     }
425
426     //
427
// Remove an element using its reference
428
// Returns the index the element had in the list
429
//
430
public int removeObjectSix(com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectSix value) {
431         return this.removeValue(OBJECT_SIX, value);
432     }
433
434     // This attribute is an array, possibly empty
435
public void setObjectSeven(int index, ObjectSeven value) {
436         this.setValue(OBJECT_SEVEN, index, value);
437     }
438
439     //
440
public ObjectSeven getObjectSeven(int index) {
441         return (ObjectSeven)this.getValue(OBJECT_SEVEN, index);
442     }
443
444     // This attribute is an array, possibly empty
445
public void setObjectSeven(ObjectSeven[] value) {
446         this.setValue(OBJECT_SEVEN, value);
447     }
448
449     //
450
public ObjectSeven[] getObjectSeven() {
451         return (ObjectSeven[])this.getValues(OBJECT_SEVEN);
452     }
453
454     // Return the number of properties
455
public int sizeObjectSeven() {
456         return this.size(OBJECT_SEVEN);
457     }
458
459     // Add a new element returning its index in the list
460
public int addObjectSeven(com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectSeven value) {
461         return this.addValue(OBJECT_SEVEN, value);
462     }
463
464     //
465
// Remove an element using its reference
466
// Returns the index the element had in the list
467
//
468
public int removeObjectSeven(com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectSeven value) {
469         return this.removeValue(OBJECT_SEVEN, value);
470     }
471
472     // This attribute is an array, possibly empty
473
public void setObjectEight(int index, ObjectEight value) {
474         this.setValue(OBJECT_EIGHT, index, value);
475     }
476
477     //
478
public ObjectEight getObjectEight(int index) {
479         return (ObjectEight)this.getValue(OBJECT_EIGHT, index);
480     }
481
482     // This attribute is an array, possibly empty
483
public void setObjectEight(ObjectEight[] value) {
484         this.setValue(OBJECT_EIGHT, value);
485     }
486
487     //
488
public ObjectEight[] getObjectEight() {
489         return (ObjectEight[])this.getValues(OBJECT_EIGHT);
490     }
491
492     // Return the number of properties
493
public int sizeObjectEight() {
494         return this.size(OBJECT_EIGHT);
495     }
496
497     // Add a new element returning its index in the list
498
public int addObjectEight(com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectEight value) {
499         return this.addValue(OBJECT_EIGHT, value);
500     }
501
502     //
503
// Remove an element using its reference
504
// Returns the index the element had in the list
505
//
506
public int removeObjectEight(com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectEight value) {
507         return this.removeValue(OBJECT_EIGHT, value);
508     }
509
510     //
511
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
512         comparators.add(c);
513     }
514
515     //
516
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
517         comparators.remove(c);
518     }
519     //
520
// This method returns the root of the bean graph
521
// Each call creates a new bean graph from the specified DOM graph
522
//
523
public static RootElement createGraph(org.w3c.dom.Node JavaDoc doc) throws org.netbeans.modules.schema2beans.Schema2BeansException {
524         return new RootElement(doc, Common.NO_DEFAULT_VALUES);
525     }
526
527     public static RootElement createGraph(java.io.InputStream JavaDoc in) throws org.netbeans.modules.schema2beans.Schema2BeansException {
528         return createGraph(in, false);
529     }
530
531     public static RootElement createGraph(java.io.InputStream JavaDoc in, boolean validate) throws org.netbeans.modules.schema2beans.Schema2BeansException {
532         Document doc = GraphManager.createXmlDocument(in, validate);
533         return createGraph(doc);
534     }
535
536     //
537
// This method returns the root for a new empty bean graph
538
//
539
public static RootElement createGraph() {
540         try {
541             return new RootElement();
542         }
543         catch (Schema2BeansException e) {
544             throw new RuntimeException JavaDoc(e.getMessage());
545         }
546     }
547
548     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
549         boolean restrictionFailure = false;
550         // Validating property nonZeroLengthProperty
551
if (getNonZeroLengthProperty() == null) {
552             throw new org.netbeans.modules.schema2beans.ValidateException("getNonZeroLengthProperty() == null", "nonZeroLengthProperty", this); // NOI18N
553
}
554         // Validating property numberProperty
555
if (sizeNumberProperty() == 0) {
556             throw new org.netbeans.modules.schema2beans.ValidateException("sizeNumberProperty() == 0", "numberProperty", this); // NOI18N
557
}
558         for (int _index = 0; _index < sizeNumberProperty(); ++_index) {
559             String JavaDoc element = getNumberProperty(_index);
560             if (element != null) {
561             }
562         }
563         // Validating property booleanProperty
564
for (int _index = 0; _index < sizeBooleanProperty(); ++_index) {
565             String JavaDoc element = getBooleanProperty(_index);
566             if (element != null) {
567             }
568         }
569         // Validating property rangeProperty
570
if (getRangeProperty() != null) {
571         }
572         // Validating property enumerationProperty
573
if (getEnumerationProperty() == null) {
574             throw new org.netbeans.modules.schema2beans.ValidateException("getEnumerationProperty() == null", "enumerationProperty", this); // NOI18N
575
}
576         // Validating property objectOne
577
if (getObjectOne() == null) {
578             throw new org.netbeans.modules.schema2beans.ValidateException("getObjectOne() == null", "objectOne", this); // NOI18N
579
}
580         getObjectOne().validate();
581         // Validating property objectTwo
582
if (getObjectTwo() != null) {
583             getObjectTwo().validate();
584         }
585         // Validating property objectThree
586
if (getObjectThree() != null) {
587             getObjectThree().validate();
588         }
589         // Validating property objectFour
590
if (getObjectFour() == null) {
591             throw new org.netbeans.modules.schema2beans.ValidateException("getObjectFour() == null", "objectFour", this); // NOI18N
592
}
593         getObjectFour().validate();
594         // Validating property objectFive
595
for (int _index = 0; _index < sizeObjectFive(); ++_index) {
596             com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectFive element = getObjectFive(_index);
597             if (element != null) {
598                 element.validate();
599             }
600         }
601         // Validating property objectSix
602
if (sizeObjectSix() == 0) {
603             throw new org.netbeans.modules.schema2beans.ValidateException("sizeObjectSix() == 0", "objectSix", this); // NOI18N
604
}
605         for (int _index = 0; _index < sizeObjectSix(); ++_index) {
606             com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectSix element = getObjectSix(_index);
607             if (element != null) {
608                 element.validate();
609             }
610         }
611         // Validating property objectSeven
612
for (int _index = 0; _index < sizeObjectSeven(); ++_index) {
613             com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectSeven element = getObjectSeven(_index);
614             if (element != null) {
615                 element.validate();
616             }
617         }
618         // Validating property objectEight
619
for (int _index = 0; _index < sizeObjectEight(); ++_index) {
620             com.sun.enterprise.tools.common.validation.samples.simple.beans.ObjectEight element = getObjectEight(_index);
621             if (element != null) {
622                 element.validate();
623             }
624         }
625     }
626
627     // Special serializer: output XML as serialization
628
private void writeObject(java.io.ObjectOutputStream JavaDoc out) throws java.io.IOException JavaDoc{
629         ByteArrayOutputStream baos = new ByteArrayOutputStream();
630         write(baos);
631         String JavaDoc str = baos.toString();;
632         // System.out.println("str='"+str+"'");
633
out.writeUTF(str);
634     }
635     // Special deserializer: read XML as deserialization
636
private void readObject(java.io.ObjectInputStream JavaDoc in) throws java.io.IOException JavaDoc, ClassNotFoundException JavaDoc{
637         try{
638             init(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
639             String JavaDoc strDocument = in.readUTF();
640             // System.out.println("strDocument='"+strDocument+"'");
641
ByteArrayInputStream bais = new ByteArrayInputStream(strDocument.getBytes());
642             Document doc = GraphManager.createXmlDocument(bais, false);
643             initOptions(Common.NO_DEFAULT_VALUES);
644             initFromNode(doc, Common.NO_DEFAULT_VALUES);
645         }
646         catch (Schema2BeansException e) {
647             e.printStackTrace();
648             throw new RuntimeException JavaDoc(e.getMessage());
649         }
650     }
651
652     // Dump the content of this bean returning it as a String
653
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
654         String JavaDoc s;
655         Object JavaDoc o;
656         org.netbeans.modules.schema2beans.BaseBean n;
657         str.append(indent);
658         str.append("NonZeroLengthProperty"); // NOI18N
659
str.append(indent+"\t"); // NOI18N
660
str.append("<"); // NOI18N
661
s = this.getNonZeroLengthProperty();
662         str.append((s==null?"null":s.trim())); // NOI18N
663
str.append(">\n"); // NOI18N
664
this.dumpAttributes(NON_ZERO_LENGTH_PROPERTY, 0, str, indent);
665
666         str.append(indent);
667         str.append("NumberProperty["+this.sizeNumberProperty()+"]"); // NOI18N
668
for(int i=0; i<this.sizeNumberProperty(); i++)
669         {
670             str.append(indent+"\t");
671             str.append("#"+i+":");
672             str.append(indent+"\t"); // NOI18N
673
str.append("<"); // NOI18N
674
s = this.getNumberProperty(i);
675             str.append((s==null?"null":s.trim())); // NOI18N
676
str.append(">\n"); // NOI18N
677
this.dumpAttributes(NUMBER_PROPERTY, i, str, indent);
678         }
679
680         str.append(indent);
681         str.append("BooleanProperty["+this.sizeBooleanProperty()+"]"); // NOI18N
682
for(int i=0; i<this.sizeBooleanProperty(); i++)
683         {
684             str.append(indent+"\t");
685             str.append("#"+i+":");
686             str.append(indent+"\t"); // NOI18N
687
str.append("<"); // NOI18N
688
s = this.getBooleanProperty(i);
689             str.append((s==null?"null":s.trim())); // NOI18N
690
str.append(">\n"); // NOI18N
691
this.dumpAttributes(BOOLEAN_PROPERTY, i, str, indent);
692         }
693
694         str.append(indent);
695         str.append("RangeProperty"); // NOI18N
696
str.append(indent+"\t"); // NOI18N
697
str.append("<"); // NOI18N
698
s = this.getRangeProperty();
699         str.append((s==null?"null":s.trim())); // NOI18N
700
str.append(">\n"); // NOI18N
701
this.dumpAttributes(RANGE_PROPERTY, 0, str, indent);
702
703         str.append(indent);
704         str.append("EnumerationProperty"); // NOI18N
705
str.append(indent+"\t"); // NOI18N
706
str.append("<"); // NOI18N
707
s = this.getEnumerationProperty();
708         str.append((s==null?"null":s.trim())); // NOI18N
709
str.append(">\n"); // NOI18N
710
this.dumpAttributes(ENUMERATION_PROPERTY, 0, str, indent);
711
712         str.append(indent);
713         str.append("ObjectOne"); // NOI18N
714
n = (org.netbeans.modules.schema2beans.BaseBean) this.getObjectOne();
715         if (n != null)
716             n.dump(str, indent + "\t"); // NOI18N
717
else
718             str.append(indent+"\tnull"); // NOI18N
719
this.dumpAttributes(OBJECT_ONE, 0, str, indent);
720
721         str.append(indent);
722         str.append("ObjectTwo"); // NOI18N
723
n = (org.netbeans.modules.schema2beans.BaseBean) this.getObjectTwo();
724         if (n != null)
725             n.dump(str, indent + "\t"); // NOI18N
726
else
727             str.append(indent+"\tnull"); // NOI18N
728
this.dumpAttributes(OBJECT_TWO, 0, str, indent);
729
730         str.append(indent);
731         str.append("ObjectThree"); // NOI18N
732
n = (org.netbeans.modules.schema2beans.BaseBean) this.getObjectThree();
733         if (n != null)
734             n.dump(str, indent + "\t"); // NOI18N
735
else
736             str.append(indent+"\tnull"); // NOI18N
737
this.dumpAttributes(OBJECT_THREE, 0, str, indent);
738
739         str.append(indent);
740         str.append("ObjectFour"); // NOI18N
741
n = (org.netbeans.modules.schema2beans.BaseBean) this.getObjectFour();
742         if (n != null)
743             n.dump(str, indent + "\t"); // NOI18N
744
else
745             str.append(indent+"\tnull"); // NOI18N
746
this.dumpAttributes(OBJECT_FOUR, 0, str, indent);
747
748         str.append(indent);
749         str.append("ObjectFive["+this.sizeObjectFive()+"]"); // NOI18N
750
for(int i=0; i<this.sizeObjectFive(); i++)
751         {
752             str.append(indent+"\t");
753             str.append("#"+i+":");
754             n = (org.netbeans.modules.schema2beans.BaseBean) this.getObjectFive(i);
755             if (n != null)
756                 n.dump(str, indent + "\t"); // NOI18N
757
else
758                 str.append(indent+"\tnull"); // NOI18N
759
this.dumpAttributes(OBJECT_FIVE, i, str, indent);
760         }
761
762         str.append(indent);
763         str.append("ObjectSix["+this.sizeObjectSix()+"]"); // NOI18N
764
for(int i=0; i<this.sizeObjectSix(); i++)
765         {
766             str.append(indent+"\t");
767             str.append("#"+i+":");
768             n = (org.netbeans.modules.schema2beans.BaseBean) this.getObjectSix(i);
769             if (n != null)
770                 n.dump(str, indent + "\t"); // NOI18N
771
else
772                 str.append(indent+"\tnull"); // NOI18N
773
this.dumpAttributes(OBJECT_SIX, i, str, indent);
774         }
775
776         str.append(indent);
777         str.append("ObjectSeven["+this.sizeObjectSeven()+"]"); // NOI18N
778
for(int i=0; i<this.sizeObjectSeven(); i++)
779         {
780             str.append(indent+"\t");
781             str.append("#"+i+":");
782             n = (org.netbeans.modules.schema2beans.BaseBean) this.getObjectSeven(i);
783             if (n != null)
784                 n.dump(str, indent + "\t"); // NOI18N
785
else
786                 str.append(indent+"\tnull"); // NOI18N
787
this.dumpAttributes(OBJECT_SEVEN, i, str, indent);
788         }
789
790         str.append(indent);
791         str.append("ObjectEight["+this.sizeObjectEight()+"]"); // NOI18N
792
for(int i=0; i<this.sizeObjectEight(); i++)
793         {
794             str.append(indent+"\t");
795             str.append("#"+i+":");
796             n = (org.netbeans.modules.schema2beans.BaseBean) this.getObjectEight(i);
797             if (n != null)
798                 n.dump(str, indent + "\t"); // NOI18N
799
else
800                 str.append(indent+"\tnull"); // NOI18N
801
this.dumpAttributes(OBJECT_EIGHT, i, str, indent);
802         }
803
804     }
805     public String JavaDoc dumpBeanNode(){
806         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
807         str.append("RootElement\n"); // NOI18N
808
this.dump(str, "\n "); // NOI18N
809
return str.toString();
810     }}
811
812 // END_NOI18N
813

814
815 /*
816         The following schema file has been used for generation:
817
818 <?xml version="1.0" encoding="UTF-8"?>
819 <!--
820     Document : sample.dtd
821     Created on : May 8, 2003, 11:18 AM
822     Author : Rajeshwar Patil
823     Description:
824         Purpose of the document follows.
825 -->
826
827 <!--
828 -->
829 <!ELEMENT root-element (non-zero-length-property, number-property+,
830     boolean-property*, range-property?, enumeration-property,
831     object-one, object-two?, object-three?, object-four,
832     object-five*, object-six+, object-seven*,object-eight*)>
833
834 <!--
835 -->
836 <!ELEMENT object-one (property-one, property-two?)>
837
838
839 <!--
840 -->
841 <!ELEMENT object-two (property-one, property-two)>
842
843
844 <!--
845 -->
846 <!ELEMENT object-three (property-one, property-two?,
847     property-three+, property-four*)>
848
849
850 <!--
851 -->
852 <!ELEMENT object-four (property-one?, property-two?)>
853
854
855 <!--
856 -->
857 <!ELEMENT object-five (property-one, property-two?)>
858
859
860 <!--
861 -->
862 <!ELEMENT object-six (property-one?, property-two?)>
863
864
865 <!--
866 -->
867 <!ELEMENT object-seven (property-one, property-two)>
868
869
870 <!--
871 -->
872 <!ELEMENT object-eight (property-one, property-two?, child-object-one,
873     child-object-two?, child-object-three*, child-object-four+)>
874
875
876 <!--
877 -->
878 <!ELEMENT child-object-one (property-one, property-two?)>
879
880
881 <!--
882 -->
883 <!ELEMENT child-object-two (property-one, property-two)>
884
885
886 <!--
887 -->
888 <!ELEMENT child-object-three (property-one?, property-two?)>
889
890
891 <!--
892 -->
893 <!ELEMENT child-object-four (property-one, property-two?,
894     property-three+, property-four*)>
895
896
897 <!ELEMENT boolean-property (#PCDATA)>
898 <!ELEMENT number-property (#PCDATA)>
899 <!ELEMENT non-zero-length-property (#PCDATA)>
900 <!ELEMENT range-property (#PCDATA)>
901 <!ELEMENT enumeration-property (#PCDATA)>
902 <!ELEMENT property-one (#PCDATA)>
903 <!ELEMENT property-two (#PCDATA)>
904 <!ELEMENT property-three (#PCDATA)>
905 <!ELEMENT property-four (#PCDATA)>
906
907 */

908
Popular Tags