KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > validation > samples > simple > beans > RootElement


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

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

75
76 package org.netbeans.modules.j2ee.sun.validation.samples.simple.beans;
77
78 import org.w3c.dom.*;
79 import org.netbeans.modules.schema2beans.*;
80 import java.beans.*;
81 import java.util.*;
82 import java.io.*;
83
84 // BEGIN_NOI18N
85

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

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

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

903
Popular Tags