View Javadoc
1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package org.exolab.castor.mapping.xml;
9   
10  /**
11   * The 'bind-xml' element is used for specifying XML specific
12   * databinding
13   *  properties and behavior for a specific field. 'bind-xml' may
14   * only appear
15   *  as a child of a 'field' element.
16   *  
17   * 
18   * @version $Revision$ $Date$
19   */
20  @SuppressWarnings("serial")
21  public class BindXml implements java.io.Serializable {
22  
23  
24        //--------------------------/
25       //- Class/Member Variables -/
26      //--------------------------/
27  
28      /**
29       * An optional attribute used for specifying the XML name for
30       * the
31       *  field associated with the 'bind-xml' element.
32       *  
33       */
34      private java.lang.String _name;
35  
36      /**
37       * Field _type.
38       */
39      private java.lang.String _type;
40  
41      /**
42       * Allows specifying how Castor should automatically determines
43       *  the XML name of this field when no name has been specified.
44       *  In most cases the XML name is determined by using the field
45       * name,
46       *  but in some cases the user may want to use the Class name
47       * of
48       *  the field type. This attribute allows choosing between the
49       *  two approaches. If this attribute is not specified, the
50       * field
51       *  name is used as the XML name.
52       *  
53       */
54      private org.exolab.castor.mapping.xml.types.BindXmlAutoNamingType _autoNaming;
55  
56      /**
57       * Allows specifying a nested location path for this field,
58       *  the value should just be a simplified XPath like value
59       *  where names are separated by "/".
60       *  
61       */
62      private java.lang.String _location;
63  
64      /**
65       * Field _matches.
66       */
67      private java.lang.String _matches;
68  
69      /**
70       * Field _reference.
71       */
72      private boolean _reference;
73  
74      /**
75       * keeps track of state for field: _reference
76       */
77      private boolean _has_reference;
78  
79      /**
80       * Field _node.
81       */
82      private org.exolab.castor.mapping.xml.types.BindXmlNodeType _node;
83  
84      /**
85       * Field _QNamePrefix.
86       */
87      private java.lang.String _QNamePrefix;
88  
89      /**
90       * Field _transient.
91       */
92      private boolean _transient;
93  
94      /**
95       * keeps track of state for field: _transient
96       */
97      private boolean _has_transient;
98  
99      /**
100      * The 'class' element is used to store information about
101      * mapping of a class.
102      *  
103      */
104     private org.exolab.castor.mapping.xml.ClassMapping _classMapping;
105 
106     /**
107      * Field _propertyList.
108      */
109     private java.util.List<org.exolab.castor.mapping.xml.Property> _propertyList;
110 
111 
112       //----------------/
113      //- Constructors -/
114     //----------------/
115 
116     public BindXml() {
117         super();
118         this._propertyList = new java.util.ArrayList<org.exolab.castor.mapping.xml.Property>();
119     }
120 
121 
122       //-----------/
123      //- Methods -/
124     //-----------/
125 
126     /**
127      * 
128      * 
129      * @param vProperty
130      * @throws java.lang.IndexOutOfBoundsException if the index
131      * given is outside the bounds of the collection
132      */
133     public void addProperty(
134             final org.exolab.castor.mapping.xml.Property vProperty)
135     throws java.lang.IndexOutOfBoundsException {
136         this._propertyList.add(vProperty);
137     }
138 
139     /**
140      * 
141      * 
142      * @param index
143      * @param vProperty
144      * @throws java.lang.IndexOutOfBoundsException if the index
145      * given is outside the bounds of the collection
146      */
147     public void addProperty(
148             final int index,
149             final org.exolab.castor.mapping.xml.Property vProperty)
150     throws java.lang.IndexOutOfBoundsException {
151         this._propertyList.add(index, vProperty);
152     }
153 
154     /**
155      */
156     public void deleteReference(
157     ) {
158         this._has_reference= false;
159     }
160 
161     /**
162      */
163     public void deleteTransient(
164     ) {
165         this._has_transient= false;
166     }
167 
168     /**
169      * Method enumerateProperty.
170      * 
171      * @return an Enumeration over all possible elements of this
172      * collection
173      */
174     public java.util.Enumeration<? extends org.exolab.castor.mapping.xml.Property> enumerateProperty(
175     ) {
176         return java.util.Collections.enumeration(this._propertyList);
177     }
178 
179     /**
180      * Returns the value of field 'autoNaming'. The field
181      * 'autoNaming' has the following description: Allows
182      * specifying how Castor should automatically determines
183      *  the XML name of this field when no name has been specified.
184      *  In most cases the XML name is determined by using the field
185      * name,
186      *  but in some cases the user may want to use the Class name
187      * of
188      *  the field type. This attribute allows choosing between the
189      *  two approaches. If this attribute is not specified, the
190      * field
191      *  name is used as the XML name.
192      *  
193      * 
194      * @return the value of field 'AutoNaming'.
195      */
196     public org.exolab.castor.mapping.xml.types.BindXmlAutoNamingType getAutoNaming(
197     ) {
198         return this._autoNaming;
199     }
200 
201     /**
202      * Returns the value of field 'classMapping'. The field
203      * 'classMapping' has the following description: The 'class'
204      * element is used to store information about mapping of a
205      * class.
206      *  
207      * 
208      * @return the value of field 'ClassMapping'.
209      */
210     public org.exolab.castor.mapping.xml.ClassMapping getClassMapping(
211     ) {
212         return this._classMapping;
213     }
214 
215     /**
216      * Returns the value of field 'location'. The field 'location'
217      * has the following description: Allows specifying a nested
218      * location path for this field,
219      *  the value should just be a simplified XPath like value
220      *  where names are separated by "/".
221      *  
222      * 
223      * @return the value of field 'Location'.
224      */
225     public java.lang.String getLocation(
226     ) {
227         return this._location;
228     }
229 
230     /**
231      * Returns the value of field 'matches'.
232      * 
233      * @return the value of field 'Matches'.
234      */
235     public java.lang.String getMatches(
236     ) {
237         return this._matches;
238     }
239 
240     /**
241      * Returns the value of field 'name'. The field 'name' has the
242      * following description: An optional attribute used for
243      * specifying the XML name for the
244      *  field associated with the 'bind-xml' element.
245      *  
246      * 
247      * @return the value of field 'Name'.
248      */
249     public java.lang.String getName(
250     ) {
251         return this._name;
252     }
253 
254     /**
255      * Returns the value of field 'node'.
256      * 
257      * @return the value of field 'Node'.
258      */
259     public org.exolab.castor.mapping.xml.types.BindXmlNodeType getNode(
260     ) {
261         return this._node;
262     }
263 
264     /**
265      * Method getProperty.
266      * 
267      * @param index
268      * @throws java.lang.IndexOutOfBoundsException if the index
269      * given is outside the bounds of the collection
270      * @return the value of the
271      * org.exolab.castor.mapping.xml.Property at the given index
272      */
273     public org.exolab.castor.mapping.xml.Property getProperty(
274             final int index)
275     throws java.lang.IndexOutOfBoundsException {
276         // check bounds for index
277         if (index < 0 || index >= this._propertyList.size()) {
278             throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
279         }
280 
281         return (org.exolab.castor.mapping.xml.Property) _propertyList.get(index);
282     }
283 
284     /**
285      * Method getProperty.Returns the contents of the collection in
286      * an Array.  <p>Note:  Just in case the collection contents
287      * are changing in another thread, we pass a 0-length Array of
288      * the correct type into the API call.  This way we <i>know</i>
289      * that the Array returned is of exactly the correct length.
290      * 
291      * @return this collection as an Array
292      */
293     public org.exolab.castor.mapping.xml.Property[] getProperty(
294     ) {
295         org.exolab.castor.mapping.xml.Property[] array = new org.exolab.castor.mapping.xml.Property[0];
296         return (org.exolab.castor.mapping.xml.Property[]) this._propertyList.toArray(array);
297     }
298 
299     /**
300      * Method getPropertyCount.
301      * 
302      * @return the size of this collection
303      */
304     public int getPropertyCount(
305     ) {
306         return this._propertyList.size();
307     }
308 
309     /**
310      * Returns the value of field 'QNamePrefix'.
311      * 
312      * @return the value of field 'QNamePrefix'.
313      */
314     public java.lang.String getQNamePrefix(
315     ) {
316         return this._QNamePrefix;
317     }
318 
319     /**
320      * Returns the value of field 'reference'.
321      * 
322      * @return the value of field 'Reference'.
323      */
324     public boolean getReference(
325     ) {
326         return this._reference;
327     }
328 
329     /**
330      * Returns the value of field 'transient'.
331      * 
332      * @return the value of field 'Transient'.
333      */
334     public boolean getTransient(
335     ) {
336         return this._transient;
337     }
338 
339     /**
340      * Returns the value of field 'type'.
341      * 
342      * @return the value of field 'Type'.
343      */
344     public java.lang.String getType(
345     ) {
346         return this._type;
347     }
348 
349     /**
350      * Method hasReference.
351      * 
352      * @return true if at least one Reference has been added
353      */
354     public boolean hasReference(
355     ) {
356         return this._has_reference;
357     }
358 
359     /**
360      * Method hasTransient.
361      * 
362      * @return true if at least one Transient has been added
363      */
364     public boolean hasTransient(
365     ) {
366         return this._has_transient;
367     }
368 
369     /**
370      * Returns the value of field 'reference'.
371      * 
372      * @return the value of field 'Reference'.
373      */
374     public boolean isReference(
375     ) {
376         return this._reference;
377     }
378 
379     /**
380      * Returns the value of field 'transient'.
381      * 
382      * @return the value of field 'Transient'.
383      */
384     public boolean isTransient(
385     ) {
386         return this._transient;
387     }
388 
389     /**
390      * Method isValid.
391      * 
392      * @return true if this object is valid according to the schema
393      */
394     public boolean isValid(
395     ) {
396         try {
397             validate();
398         } catch (org.exolab.castor.xml.ValidationException vex) {
399             return false;
400         }
401         return true;
402     }
403 
404     /**
405      * Method iterateProperty.
406      * 
407      * @return an Iterator over all possible elements in this
408      * collection
409      */
410     public java.util.Iterator<? extends org.exolab.castor.mapping.xml.Property> iterateProperty(
411     ) {
412         return this._propertyList.iterator();
413     }
414 
415     /**
416      * 
417      * 
418      * @param out
419      * @throws org.exolab.castor.xml.MarshalException if object is
420      * null or if any SAXException is thrown during marshaling
421      * @throws org.exolab.castor.xml.ValidationException if this
422      * object is an invalid instance according to the schema
423      */
424     public void marshal(
425             final java.io.Writer out)
426     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
427         org.exolab.castor.xml.Marshaller.marshal(this, out);
428     }
429 
430     /**
431      * 
432      * 
433      * @param handler
434      * @throws java.io.IOException if an IOException occurs during
435      * marshaling
436      * @throws org.exolab.castor.xml.ValidationException if this
437      * object is an invalid instance according to the schema
438      * @throws org.exolab.castor.xml.MarshalException if object is
439      * null or if any SAXException is thrown during marshaling
440      */
441     public void marshal(
442             final org.xml.sax.ContentHandler handler)
443     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
444         org.exolab.castor.xml.Marshaller.marshal(this, handler);
445     }
446 
447     /**
448      */
449     public void removeAllProperty(
450     ) {
451         this._propertyList.clear();
452     }
453 
454     /**
455      * Method removeProperty.
456      * 
457      * @param vProperty
458      * @return true if the object was removed from the collection.
459      */
460     public boolean removeProperty(
461             final org.exolab.castor.mapping.xml.Property vProperty) {
462         boolean removed = _propertyList.remove(vProperty);
463         return removed;
464     }
465 
466     /**
467      * Method removePropertyAt.
468      * 
469      * @param index
470      * @return the element removed from the collection
471      */
472     public org.exolab.castor.mapping.xml.Property removePropertyAt(
473             final int index) {
474         java.lang.Object obj = this._propertyList.remove(index);
475         return (org.exolab.castor.mapping.xml.Property) obj;
476     }
477 
478     /**
479      * Sets the value of field 'autoNaming'. The field 'autoNaming'
480      * has the following description: Allows specifying how Castor
481      * should automatically determines
482      *  the XML name of this field when no name has been specified.
483      *  In most cases the XML name is determined by using the field
484      * name,
485      *  but in some cases the user may want to use the Class name
486      * of
487      *  the field type. This attribute allows choosing between the
488      *  two approaches. If this attribute is not specified, the
489      * field
490      *  name is used as the XML name.
491      *  
492      * 
493      * @param autoNaming the value of field 'autoNaming'.
494      */
495     public void setAutoNaming(
496             final org.exolab.castor.mapping.xml.types.BindXmlAutoNamingType autoNaming) {
497         this._autoNaming = autoNaming;
498     }
499 
500     /**
501      * Sets the value of field 'classMapping'. The field
502      * 'classMapping' has the following description: The 'class'
503      * element is used to store information about mapping of a
504      * class.
505      *  
506      * 
507      * @param classMapping the value of field 'classMapping'.
508      */
509     public void setClassMapping(
510             final org.exolab.castor.mapping.xml.ClassMapping classMapping) {
511         this._classMapping = classMapping;
512     }
513 
514     /**
515      * Sets the value of field 'location'. The field 'location' has
516      * the following description: Allows specifying a nested
517      * location path for this field,
518      *  the value should just be a simplified XPath like value
519      *  where names are separated by "/".
520      *  
521      * 
522      * @param location the value of field 'location'.
523      */
524     public void setLocation(
525             final java.lang.String location) {
526         this._location = location;
527     }
528 
529     /**
530      * Sets the value of field 'matches'.
531      * 
532      * @param matches the value of field 'matches'.
533      */
534     public void setMatches(
535             final java.lang.String matches) {
536         this._matches = matches;
537     }
538 
539     /**
540      * Sets the value of field 'name'. The field 'name' has the
541      * following description: An optional attribute used for
542      * specifying the XML name for the
543      *  field associated with the 'bind-xml' element.
544      *  
545      * 
546      * @param name the value of field 'name'.
547      */
548     public void setName(
549             final java.lang.String name) {
550         this._name = name;
551     }
552 
553     /**
554      * Sets the value of field 'node'.
555      * 
556      * @param node the value of field 'node'.
557      */
558     public void setNode(
559             final org.exolab.castor.mapping.xml.types.BindXmlNodeType node) {
560         this._node = node;
561     }
562 
563     /**
564      * 
565      * 
566      * @param index
567      * @param vProperty
568      * @throws java.lang.IndexOutOfBoundsException if the index
569      * given is outside the bounds of the collection
570      */
571     public void setProperty(
572             final int index,
573             final org.exolab.castor.mapping.xml.Property vProperty)
574     throws java.lang.IndexOutOfBoundsException {
575         // check bounds for index
576         if (index < 0 || index >= this._propertyList.size()) {
577             throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
578         }
579 
580         this._propertyList.set(index, vProperty);
581     }
582 
583     /**
584      * 
585      * 
586      * @param vPropertyArray
587      */
588     public void setProperty(
589             final org.exolab.castor.mapping.xml.Property[] vPropertyArray) {
590         //-- copy array
591         _propertyList.clear();
592 
593         for (int i = 0; i < vPropertyArray.length; i++) {
594                 this._propertyList.add(vPropertyArray[i]);
595         }
596     }
597 
598     /**
599      * Sets the value of field 'QNamePrefix'.
600      * 
601      * @param QNamePrefix the value of field 'QNamePrefix'.
602      */
603     public void setQNamePrefix(
604             final java.lang.String QNamePrefix) {
605         this._QNamePrefix = QNamePrefix;
606     }
607 
608     /**
609      * Sets the value of field 'reference'.
610      * 
611      * @param reference the value of field 'reference'.
612      */
613     public void setReference(
614             final boolean reference) {
615         this._reference = reference;
616         this._has_reference = true;
617     }
618 
619     /**
620      * Sets the value of field 'transient'.
621      * 
622      * @param _transient
623      * @param transient the value of field 'transient'.
624      */
625     public void setTransient(
626             final boolean _transient) {
627         this._transient = _transient;
628         this._has_transient = true;
629     }
630 
631     /**
632      * Sets the value of field 'type'.
633      * 
634      * @param type the value of field 'type'.
635      */
636     public void setType(
637             final java.lang.String type) {
638         this._type = type;
639     }
640 
641     /**
642      * Method unmarshal.
643      * 
644      * @param reader
645      * @throws org.exolab.castor.xml.MarshalException if object is
646      * null or if any SAXException is thrown during marshaling
647      * @throws org.exolab.castor.xml.ValidationException if this
648      * object is an invalid instance according to the schema
649      * @return the unmarshaled org.exolab.castor.mapping.xml.BindXml
650      */
651     public static org.exolab.castor.mapping.xml.BindXml unmarshal(
652             final java.io.Reader reader)
653     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
654         return (org.exolab.castor.mapping.xml.BindXml) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.BindXml.class, reader);
655     }
656 
657     /**
658      * 
659      * 
660      * @throws org.exolab.castor.xml.ValidationException if this
661      * object is an invalid instance according to the schema
662      */
663     public void validate(
664     )
665     throws org.exolab.castor.xml.ValidationException {
666         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
667         validator.validate(this);
668     }
669 
670 }