1
2
3
4
5
6
7
8 package org.exolab.castor.mapping.xml;
9
10
11
12
13
14
15 @SuppressWarnings("serial")
16 public class MappingRoot implements java.io.Serializable {
17
18
19
20
21
22
23
24
25
26 private java.lang.String _description;
27
28
29
30
31 private java.util.List<org.exolab.castor.mapping.xml.Include> _includeList;
32
33
34
35
36 private java.util.List<org.exolab.castor.mapping.xml.FieldHandlerDef> _fieldHandlerDefList;
37
38
39
40
41
42
43 private java.util.List<org.exolab.castor.mapping.xml.ClassMapping> _classMappingList;
44
45
46
47
48 private java.util.List<org.exolab.castor.mapping.xml.KeyGeneratorDef> _keyGeneratorDefList;
49
50
51
52
53
54
55 public MappingRoot() {
56 super();
57 this._includeList = new java.util.ArrayList<org.exolab.castor.mapping.xml.Include>();
58 this._fieldHandlerDefList = new java.util.ArrayList<org.exolab.castor.mapping.xml.FieldHandlerDef>();
59 this._classMappingList = new java.util.ArrayList<org.exolab.castor.mapping.xml.ClassMapping>();
60 this._keyGeneratorDefList = new java.util.ArrayList<org.exolab.castor.mapping.xml.KeyGeneratorDef>();
61 }
62
63
64
65
66
67
68
69
70
71
72
73
74
75 public void addClassMapping(
76 final org.exolab.castor.mapping.xml.ClassMapping vClassMapping)
77 throws java.lang.IndexOutOfBoundsException {
78 this._classMappingList.add(vClassMapping);
79 }
80
81
82
83
84
85
86
87
88
89 public void addClassMapping(
90 final int index,
91 final org.exolab.castor.mapping.xml.ClassMapping vClassMapping)
92 throws java.lang.IndexOutOfBoundsException {
93 this._classMappingList.add(index, vClassMapping);
94 }
95
96
97
98
99
100
101
102
103 public void addFieldHandlerDef(
104 final org.exolab.castor.mapping.xml.FieldHandlerDef vFieldHandlerDef)
105 throws java.lang.IndexOutOfBoundsException {
106 this._fieldHandlerDefList.add(vFieldHandlerDef);
107 }
108
109
110
111
112
113
114
115
116
117 public void addFieldHandlerDef(
118 final int index,
119 final org.exolab.castor.mapping.xml.FieldHandlerDef vFieldHandlerDef)
120 throws java.lang.IndexOutOfBoundsException {
121 this._fieldHandlerDefList.add(index, vFieldHandlerDef);
122 }
123
124
125
126
127
128
129
130
131 public void addInclude(
132 final org.exolab.castor.mapping.xml.Include vInclude)
133 throws java.lang.IndexOutOfBoundsException {
134 this._includeList.add(vInclude);
135 }
136
137
138
139
140
141
142
143
144
145 public void addInclude(
146 final int index,
147 final org.exolab.castor.mapping.xml.Include vInclude)
148 throws java.lang.IndexOutOfBoundsException {
149 this._includeList.add(index, vInclude);
150 }
151
152
153
154
155
156
157
158
159 public void addKeyGeneratorDef(
160 final org.exolab.castor.mapping.xml.KeyGeneratorDef vKeyGeneratorDef)
161 throws java.lang.IndexOutOfBoundsException {
162 this._keyGeneratorDefList.add(vKeyGeneratorDef);
163 }
164
165
166
167
168
169
170
171
172
173 public void addKeyGeneratorDef(
174 final int index,
175 final org.exolab.castor.mapping.xml.KeyGeneratorDef vKeyGeneratorDef)
176 throws java.lang.IndexOutOfBoundsException {
177 this._keyGeneratorDefList.add(index, vKeyGeneratorDef);
178 }
179
180
181
182
183
184
185
186 public java.util.Enumeration<? extends org.exolab.castor.mapping.xml.ClassMapping> enumerateClassMapping(
187 ) {
188 return java.util.Collections.enumeration(this._classMappingList);
189 }
190
191
192
193
194
195
196
197 public java.util.Enumeration<? extends org.exolab.castor.mapping.xml.FieldHandlerDef> enumerateFieldHandlerDef(
198 ) {
199 return java.util.Collections.enumeration(this._fieldHandlerDefList);
200 }
201
202
203
204
205
206
207
208 public java.util.Enumeration<? extends org.exolab.castor.mapping.xml.Include> enumerateInclude(
209 ) {
210 return java.util.Collections.enumeration(this._includeList);
211 }
212
213
214
215
216
217
218
219 public java.util.Enumeration<? extends org.exolab.castor.mapping.xml.KeyGeneratorDef> enumerateKeyGeneratorDef(
220 ) {
221 return java.util.Collections.enumeration(this._keyGeneratorDefList);
222 }
223
224
225
226
227
228
229
230
231
232
233 public org.exolab.castor.mapping.xml.ClassMapping getClassMapping(
234 final int index)
235 throws java.lang.IndexOutOfBoundsException {
236
237 if (index < 0 || index >= this._classMappingList.size()) {
238 throw new IndexOutOfBoundsException("getClassMapping: Index value '" + index + "' not in range [0.." + (this._classMappingList.size() - 1) + "]");
239 }
240
241 return (org.exolab.castor.mapping.xml.ClassMapping) _classMappingList.get(index);
242 }
243
244
245
246
247
248
249
250
251
252
253
254 public org.exolab.castor.mapping.xml.ClassMapping[] getClassMapping(
255 ) {
256 org.exolab.castor.mapping.xml.ClassMapping[] array = new org.exolab.castor.mapping.xml.ClassMapping[0];
257 return (org.exolab.castor.mapping.xml.ClassMapping[]) this._classMappingList.toArray(array);
258 }
259
260
261
262
263
264
265 public int getClassMappingCount(
266 ) {
267 return this._classMappingList.size();
268 }
269
270
271
272
273
274
275 public java.lang.String getDescription(
276 ) {
277 return this._description;
278 }
279
280
281
282
283
284
285
286
287
288
289
290 public org.exolab.castor.mapping.xml.FieldHandlerDef getFieldHandlerDef(
291 final int index)
292 throws java.lang.IndexOutOfBoundsException {
293
294 if (index < 0 || index >= this._fieldHandlerDefList.size()) {
295 throw new IndexOutOfBoundsException("getFieldHandlerDef: Index value '" + index + "' not in range [0.." + (this._fieldHandlerDefList.size() - 1) + "]");
296 }
297
298 return (org.exolab.castor.mapping.xml.FieldHandlerDef) _fieldHandlerDefList.get(index);
299 }
300
301
302
303
304
305
306
307
308
309
310
311 public org.exolab.castor.mapping.xml.FieldHandlerDef[] getFieldHandlerDef(
312 ) {
313 org.exolab.castor.mapping.xml.FieldHandlerDef[] array = new org.exolab.castor.mapping.xml.FieldHandlerDef[0];
314 return (org.exolab.castor.mapping.xml.FieldHandlerDef[]) this._fieldHandlerDefList.toArray(array);
315 }
316
317
318
319
320
321
322 public int getFieldHandlerDefCount(
323 ) {
324 return this._fieldHandlerDefList.size();
325 }
326
327
328
329
330
331
332
333
334
335
336 public org.exolab.castor.mapping.xml.Include getInclude(
337 final int index)
338 throws java.lang.IndexOutOfBoundsException {
339
340 if (index < 0 || index >= this._includeList.size()) {
341 throw new IndexOutOfBoundsException("getInclude: Index value '" + index + "' not in range [0.." + (this._includeList.size() - 1) + "]");
342 }
343
344 return (org.exolab.castor.mapping.xml.Include) _includeList.get(index);
345 }
346
347
348
349
350
351
352
353
354
355
356 public org.exolab.castor.mapping.xml.Include[] getInclude(
357 ) {
358 org.exolab.castor.mapping.xml.Include[] array = new org.exolab.castor.mapping.xml.Include[0];
359 return (org.exolab.castor.mapping.xml.Include[]) this._includeList.toArray(array);
360 }
361
362
363
364
365
366
367 public int getIncludeCount(
368 ) {
369 return this._includeList.size();
370 }
371
372
373
374
375
376
377
378
379
380
381
382 public org.exolab.castor.mapping.xml.KeyGeneratorDef getKeyGeneratorDef(
383 final int index)
384 throws java.lang.IndexOutOfBoundsException {
385
386 if (index < 0 || index >= this._keyGeneratorDefList.size()) {
387 throw new IndexOutOfBoundsException("getKeyGeneratorDef: Index value '" + index + "' not in range [0.." + (this._keyGeneratorDefList.size() - 1) + "]");
388 }
389
390 return (org.exolab.castor.mapping.xml.KeyGeneratorDef) _keyGeneratorDefList.get(index);
391 }
392
393
394
395
396
397
398
399
400
401
402
403 public org.exolab.castor.mapping.xml.KeyGeneratorDef[] getKeyGeneratorDef(
404 ) {
405 org.exolab.castor.mapping.xml.KeyGeneratorDef[] array = new org.exolab.castor.mapping.xml.KeyGeneratorDef[0];
406 return (org.exolab.castor.mapping.xml.KeyGeneratorDef[]) this._keyGeneratorDefList.toArray(array);
407 }
408
409
410
411
412
413
414 public int getKeyGeneratorDefCount(
415 ) {
416 return this._keyGeneratorDefList.size();
417 }
418
419
420
421
422
423
424 public boolean isValid(
425 ) {
426 try {
427 validate();
428 } catch (org.exolab.castor.xml.ValidationException vex) {
429 return false;
430 }
431 return true;
432 }
433
434
435
436
437
438
439
440 public java.util.Iterator<? extends org.exolab.castor.mapping.xml.ClassMapping> iterateClassMapping(
441 ) {
442 return this._classMappingList.iterator();
443 }
444
445
446
447
448
449
450
451 public java.util.Iterator<? extends org.exolab.castor.mapping.xml.FieldHandlerDef> iterateFieldHandlerDef(
452 ) {
453 return this._fieldHandlerDefList.iterator();
454 }
455
456
457
458
459
460
461
462 public java.util.Iterator<? extends org.exolab.castor.mapping.xml.Include> iterateInclude(
463 ) {
464 return this._includeList.iterator();
465 }
466
467
468
469
470
471
472
473 public java.util.Iterator<? extends org.exolab.castor.mapping.xml.KeyGeneratorDef> iterateKeyGeneratorDef(
474 ) {
475 return this._keyGeneratorDefList.iterator();
476 }
477
478
479
480
481
482
483
484
485
486
487 public void marshal(
488 final java.io.Writer out)
489 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
490 org.exolab.castor.xml.Marshaller.marshal(this, out);
491 }
492
493
494
495
496
497
498
499
500
501
502
503
504 public void marshal(
505 final org.xml.sax.ContentHandler handler)
506 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
507 org.exolab.castor.xml.Marshaller.marshal(this, handler);
508 }
509
510
511
512 public void removeAllClassMapping(
513 ) {
514 this._classMappingList.clear();
515 }
516
517
518
519 public void removeAllFieldHandlerDef(
520 ) {
521 this._fieldHandlerDefList.clear();
522 }
523
524
525
526 public void removeAllInclude(
527 ) {
528 this._includeList.clear();
529 }
530
531
532
533 public void removeAllKeyGeneratorDef(
534 ) {
535 this._keyGeneratorDefList.clear();
536 }
537
538
539
540
541
542
543
544 public boolean removeClassMapping(
545 final org.exolab.castor.mapping.xml.ClassMapping vClassMapping) {
546 boolean removed = _classMappingList.remove(vClassMapping);
547 return removed;
548 }
549
550
551
552
553
554
555
556 public org.exolab.castor.mapping.xml.ClassMapping removeClassMappingAt(
557 final int index) {
558 java.lang.Object obj = this._classMappingList.remove(index);
559 return (org.exolab.castor.mapping.xml.ClassMapping) obj;
560 }
561
562
563
564
565
566
567
568 public boolean removeFieldHandlerDef(
569 final org.exolab.castor.mapping.xml.FieldHandlerDef vFieldHandlerDef) {
570 boolean removed = _fieldHandlerDefList.remove(vFieldHandlerDef);
571 return removed;
572 }
573
574
575
576
577
578
579
580 public org.exolab.castor.mapping.xml.FieldHandlerDef removeFieldHandlerDefAt(
581 final int index) {
582 java.lang.Object obj = this._fieldHandlerDefList.remove(index);
583 return (org.exolab.castor.mapping.xml.FieldHandlerDef) obj;
584 }
585
586
587
588
589
590
591
592 public boolean removeInclude(
593 final org.exolab.castor.mapping.xml.Include vInclude) {
594 boolean removed = _includeList.remove(vInclude);
595 return removed;
596 }
597
598
599
600
601
602
603
604 public org.exolab.castor.mapping.xml.Include removeIncludeAt(
605 final int index) {
606 java.lang.Object obj = this._includeList.remove(index);
607 return (org.exolab.castor.mapping.xml.Include) obj;
608 }
609
610
611
612
613
614
615
616 public boolean removeKeyGeneratorDef(
617 final org.exolab.castor.mapping.xml.KeyGeneratorDef vKeyGeneratorDef) {
618 boolean removed = _keyGeneratorDefList.remove(vKeyGeneratorDef);
619 return removed;
620 }
621
622
623
624
625
626
627
628 public org.exolab.castor.mapping.xml.KeyGeneratorDef removeKeyGeneratorDefAt(
629 final int index) {
630 java.lang.Object obj = this._keyGeneratorDefList.remove(index);
631 return (org.exolab.castor.mapping.xml.KeyGeneratorDef) obj;
632 }
633
634
635
636
637
638
639
640
641
642 public void setClassMapping(
643 final int index,
644 final org.exolab.castor.mapping.xml.ClassMapping vClassMapping)
645 throws java.lang.IndexOutOfBoundsException {
646
647 if (index < 0 || index >= this._classMappingList.size()) {
648 throw new IndexOutOfBoundsException("setClassMapping: Index value '" + index + "' not in range [0.." + (this._classMappingList.size() - 1) + "]");
649 }
650
651 this._classMappingList.set(index, vClassMapping);
652 }
653
654
655
656
657
658
659 public void setClassMapping(
660 final org.exolab.castor.mapping.xml.ClassMapping[] vClassMappingArray) {
661
662 _classMappingList.clear();
663
664 for (int i = 0; i < vClassMappingArray.length; i++) {
665 this._classMappingList.add(vClassMappingArray[i]);
666 }
667 }
668
669
670
671
672
673
674 public void setDescription(
675 final java.lang.String description) {
676 this._description = description;
677 }
678
679
680
681
682
683
684
685
686
687 public void setFieldHandlerDef(
688 final int index,
689 final org.exolab.castor.mapping.xml.FieldHandlerDef vFieldHandlerDef)
690 throws java.lang.IndexOutOfBoundsException {
691
692 if (index < 0 || index >= this._fieldHandlerDefList.size()) {
693 throw new IndexOutOfBoundsException("setFieldHandlerDef: Index value '" + index + "' not in range [0.." + (this._fieldHandlerDefList.size() - 1) + "]");
694 }
695
696 this._fieldHandlerDefList.set(index, vFieldHandlerDef);
697 }
698
699
700
701
702
703
704 public void setFieldHandlerDef(
705 final org.exolab.castor.mapping.xml.FieldHandlerDef[] vFieldHandlerDefArray) {
706
707 _fieldHandlerDefList.clear();
708
709 for (int i = 0; i < vFieldHandlerDefArray.length; i++) {
710 this._fieldHandlerDefList.add(vFieldHandlerDefArray[i]);
711 }
712 }
713
714
715
716
717
718
719
720
721
722 public void setInclude(
723 final int index,
724 final org.exolab.castor.mapping.xml.Include vInclude)
725 throws java.lang.IndexOutOfBoundsException {
726
727 if (index < 0 || index >= this._includeList.size()) {
728 throw new IndexOutOfBoundsException("setInclude: Index value '" + index + "' not in range [0.." + (this._includeList.size() - 1) + "]");
729 }
730
731 this._includeList.set(index, vInclude);
732 }
733
734
735
736
737
738
739 public void setInclude(
740 final org.exolab.castor.mapping.xml.Include[] vIncludeArray) {
741
742 _includeList.clear();
743
744 for (int i = 0; i < vIncludeArray.length; i++) {
745 this._includeList.add(vIncludeArray[i]);
746 }
747 }
748
749
750
751
752
753
754
755
756
757 public void setKeyGeneratorDef(
758 final int index,
759 final org.exolab.castor.mapping.xml.KeyGeneratorDef vKeyGeneratorDef)
760 throws java.lang.IndexOutOfBoundsException {
761
762 if (index < 0 || index >= this._keyGeneratorDefList.size()) {
763 throw new IndexOutOfBoundsException("setKeyGeneratorDef: Index value '" + index + "' not in range [0.." + (this._keyGeneratorDefList.size() - 1) + "]");
764 }
765
766 this._keyGeneratorDefList.set(index, vKeyGeneratorDef);
767 }
768
769
770
771
772
773
774 public void setKeyGeneratorDef(
775 final org.exolab.castor.mapping.xml.KeyGeneratorDef[] vKeyGeneratorDefArray) {
776
777 _keyGeneratorDefList.clear();
778
779 for (int i = 0; i < vKeyGeneratorDefArray.length; i++) {
780 this._keyGeneratorDefList.add(vKeyGeneratorDefArray[i]);
781 }
782 }
783
784
785
786
787
788
789
790
791
792
793
794
795 public static org.exolab.castor.mapping.xml.MappingRoot unmarshal(
796 final java.io.Reader reader)
797 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
798 return (org.exolab.castor.mapping.xml.MappingRoot) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.MappingRoot.class, reader);
799 }
800
801
802
803
804
805
806
807 public void validate(
808 )
809 throws org.exolab.castor.xml.ValidationException {
810 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
811 validator.validate(this);
812 }
813
814 }