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.builder.binding.xml;
9   
10  /**
11   * This type gathers the needed information to generate a Java
12   * Class
13   *  from a binding file. Options such as generating the equals
14   * method,
15   *  using wrapper classes for primitives or using bound properties
16   * can
17   *  be defined via that element. When defined locally the options
18   * override
19   *  the values defined in the castor.properties file.
20   *  
21   * 
22   * @version $Revision$ $Date$
23   */
24  public class ClassType implements java.io.Serializable {
25  
26  
27        //--------------------------/
28       //- Class/Member Variables -/
29      //--------------------------/
30  
31      /**
32       * Field _package.
33       */
34      private java.lang.String _package;
35  
36      /**
37       * Field _name.
38       */
39      private java.lang.String _name;
40  
41      /**
42       * Field _final.
43       */
44      private boolean _final;
45  
46      /**
47       * keeps track of state for field: _final
48       */
49      private boolean _has_final;
50  
51      /**
52       * Field _abstract.
53       */
54      private boolean _abstract;
55  
56      /**
57       * keeps track of state for field: _abstract
58       */
59      private boolean _has_abstract;
60  
61      /**
62       * Field _equals.
63       */
64      private boolean _equals;
65  
66      /**
67       * keeps track of state for field: _equals
68       */
69      private boolean _has_equals;
70  
71      /**
72       * Field _bound.
73       */
74      private boolean _bound;
75  
76      /**
77       * keeps track of state for field: _bound
78       */
79      private boolean _has_bound;
80  
81      /**
82       * Field _implementsList.
83       */
84      private java.util.List _implementsList;
85  
86      /**
87       * Field _extends.
88       */
89      private java.lang.String _extends;
90  
91  
92        //----------------/
93       //- Constructors -/
94      //----------------/
95  
96      public ClassType() {
97          super();
98          this._implementsList = new java.util.ArrayList();
99      }
100 
101 
102       //-----------/
103      //- Methods -/
104     //-----------/
105 
106     /**
107      * 
108      * 
109      * @param vImplements
110      * @throws java.lang.IndexOutOfBoundsException if the index
111      * given is outside the bounds of the collection
112      */
113     public void addImplements(
114             final java.lang.String vImplements)
115     throws java.lang.IndexOutOfBoundsException {
116         this._implementsList.add(vImplements);
117     }
118 
119     /**
120      * 
121      * 
122      * @param index
123      * @param vImplements
124      * @throws java.lang.IndexOutOfBoundsException if the index
125      * given is outside the bounds of the collection
126      */
127     public void addImplements(
128             final int index,
129             final java.lang.String vImplements)
130     throws java.lang.IndexOutOfBoundsException {
131         this._implementsList.add(index, vImplements);
132     }
133 
134     /**
135      */
136     public void deleteAbstract(
137     ) {
138         this._has_abstract= false;
139     }
140 
141     /**
142      */
143     public void deleteBound(
144     ) {
145         this._has_bound= false;
146     }
147 
148     /**
149      */
150     public void deleteEquals(
151     ) {
152         this._has_equals= false;
153     }
154 
155     /**
156      */
157     public void deleteFinal(
158     ) {
159         this._has_final= false;
160     }
161 
162     /**
163      * Method enumerateImplements.
164      * 
165      * @return an Enumeration over all possible elements of this
166      * collection
167      */
168     public java.util.Enumeration enumerateImplements(
169     ) {
170         return java.util.Collections.enumeration(this._implementsList);
171     }
172 
173     /**
174      * Returns the value of field 'abstract'.
175      * 
176      * @return the value of field 'Abstract'.
177      */
178     public boolean getAbstract(
179     ) {
180         return this._abstract;
181     }
182 
183     /**
184      * Returns the value of field 'bound'.
185      * 
186      * @return the value of field 'Bound'.
187      */
188     public boolean getBound(
189     ) {
190         return this._bound;
191     }
192 
193     /**
194      * Returns the value of field 'equals'.
195      * 
196      * @return the value of field 'Equals'.
197      */
198     public boolean getEquals(
199     ) {
200         return this._equals;
201     }
202 
203     /**
204      * Returns the value of field 'extends'.
205      * 
206      * @return the value of field 'Extends'.
207      */
208     public java.lang.String getExtends(
209     ) {
210         return this._extends;
211     }
212 
213     /**
214      * Returns the value of field 'final'.
215      * 
216      * @return the value of field 'Final'.
217      */
218     public boolean getFinal(
219     ) {
220         return this._final;
221     }
222 
223     /**
224      * Method getImplements.
225      * 
226      * @param index
227      * @throws java.lang.IndexOutOfBoundsException if the index
228      * given is outside the bounds of the collection
229      * @return the value of the java.lang.String at the given index
230      */
231     public java.lang.String getImplements(
232             final int index)
233     throws java.lang.IndexOutOfBoundsException {
234         // check bounds for index
235         if (index < 0 || index >= this._implementsList.size()) {
236             throw new IndexOutOfBoundsException("getImplements: Index value '" + index + "' not in range [0.." + (this._implementsList.size() - 1) + "]");
237         }
238 
239         return (java.lang.String) _implementsList.get(index);
240     }
241 
242     /**
243      * Method getImplements.Returns the contents of the collection
244      * in an Array.  <p>Note:  Just in case the collection contents
245      * are changing in another thread, we pass a 0-length Array of
246      * the correct type into the API call.  This way we <i>know</i>
247      * that the Array returned is of exactly the correct length.
248      * 
249      * @return this collection as an Array
250      */
251     public java.lang.String[] getImplements(
252     ) {
253         java.lang.String[] array = new java.lang.String[0];
254         return (java.lang.String[]) this._implementsList.toArray(array);
255     }
256 
257     /**
258      * Method getImplementsCount.
259      * 
260      * @return the size of this collection
261      */
262     public int getImplementsCount(
263     ) {
264         return this._implementsList.size();
265     }
266 
267     /**
268      * Returns the value of field 'name'.
269      * 
270      * @return the value of field 'Name'.
271      */
272     public java.lang.String getName(
273     ) {
274         return this._name;
275     }
276 
277     /**
278      * Returns the value of field 'package'.
279      * 
280      * @return the value of field 'Package'.
281      */
282     public java.lang.String getPackage(
283     ) {
284         return this._package;
285     }
286 
287     /**
288      * Method hasAbstract.
289      * 
290      * @return true if at least one Abstract has been added
291      */
292     public boolean hasAbstract(
293     ) {
294         return this._has_abstract;
295     }
296 
297     /**
298      * Method hasBound.
299      * 
300      * @return true if at least one Bound has been added
301      */
302     public boolean hasBound(
303     ) {
304         return this._has_bound;
305     }
306 
307     /**
308      * Method hasEquals.
309      * 
310      * @return true if at least one Equals has been added
311      */
312     public boolean hasEquals(
313     ) {
314         return this._has_equals;
315     }
316 
317     /**
318      * Method hasFinal.
319      * 
320      * @return true if at least one Final has been added
321      */
322     public boolean hasFinal(
323     ) {
324         return this._has_final;
325     }
326 
327     /**
328      * Returns the value of field 'abstract'.
329      * 
330      * @return the value of field 'Abstract'.
331      */
332     public boolean isAbstract(
333     ) {
334         return this._abstract;
335     }
336 
337     /**
338      * Returns the value of field 'bound'.
339      * 
340      * @return the value of field 'Bound'.
341      */
342     public boolean isBound(
343     ) {
344         return this._bound;
345     }
346 
347     /**
348      * Returns the value of field 'equals'.
349      * 
350      * @return the value of field 'Equals'.
351      */
352     public boolean isEquals(
353     ) {
354         return this._equals;
355     }
356 
357     /**
358      * Returns the value of field 'final'.
359      * 
360      * @return the value of field 'Final'.
361      */
362     public boolean isFinal(
363     ) {
364         return this._final;
365     }
366 
367     /**
368      * Method isValid.
369      * 
370      * @return true if this object is valid according to the schema
371      */
372     public boolean isValid(
373     ) {
374         try {
375             validate();
376         } catch (org.exolab.castor.xml.ValidationException vex) {
377             return false;
378         }
379         return true;
380     }
381 
382     /**
383      * Method iterateImplements.
384      * 
385      * @return an Iterator over all possible elements in this
386      * collection
387      */
388     public java.util.Iterator iterateImplements(
389     ) {
390         return this._implementsList.iterator();
391     }
392 
393     /**
394      * 
395      * 
396      * @param out
397      * @throws org.exolab.castor.xml.MarshalException if object is
398      * null or if any SAXException is thrown during marshaling
399      * @throws org.exolab.castor.xml.ValidationException if this
400      * object is an invalid instance according to the schema
401      */
402     public void marshal(
403             final java.io.Writer out)
404     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
405         org.exolab.castor.xml.Marshaller.marshal(this, out);
406     }
407 
408     /**
409      * 
410      * 
411      * @param handler
412      * @throws java.io.IOException if an IOException occurs during
413      * marshaling
414      * @throws org.exolab.castor.xml.ValidationException if this
415      * object is an invalid instance according to the schema
416      * @throws org.exolab.castor.xml.MarshalException if object is
417      * null or if any SAXException is thrown during marshaling
418      */
419     public void marshal(
420             final org.xml.sax.ContentHandler handler)
421     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
422         org.exolab.castor.xml.Marshaller.marshal(this, handler);
423     }
424 
425     /**
426      */
427     public void removeAllImplements(
428     ) {
429         this._implementsList.clear();
430     }
431 
432     /**
433      * Method removeImplements.
434      * 
435      * @param vImplements
436      * @return true if the object was removed from the collection.
437      */
438     public boolean removeImplements(
439             final java.lang.String vImplements) {
440         boolean removed = _implementsList.remove(vImplements);
441         return removed;
442     }
443 
444     /**
445      * Method removeImplementsAt.
446      * 
447      * @param index
448      * @return the element removed from the collection
449      */
450     public java.lang.String removeImplementsAt(
451             final int index) {
452         java.lang.Object obj = this._implementsList.remove(index);
453         return (java.lang.String) obj;
454     }
455 
456     /**
457      * Sets the value of field 'abstract'.
458      * 
459      * @param _abstract
460      * @param abstract the value of field 'abstract'.
461      */
462     public void setAbstract(
463             final boolean _abstract) {
464         this._abstract = _abstract;
465         this._has_abstract = true;
466     }
467 
468     /**
469      * Sets the value of field 'bound'.
470      * 
471      * @param bound the value of field 'bound'.
472      */
473     public void setBound(
474             final boolean bound) {
475         this._bound = bound;
476         this._has_bound = true;
477     }
478 
479     /**
480      * Sets the value of field 'equals'.
481      * 
482      * @param equals the value of field 'equals'.
483      */
484     public void setEquals(
485             final boolean equals) {
486         this._equals = equals;
487         this._has_equals = true;
488     }
489 
490     /**
491      * Sets the value of field 'extends'.
492      * 
493      * @param _extends
494      * @param extends the value of field 'extends'.
495      */
496     public void setExtends(
497             final java.lang.String _extends) {
498         this._extends = _extends;
499     }
500 
501     /**
502      * Sets the value of field 'final'.
503      * 
504      * @param _final
505      * @param final the value of field 'final'.
506      */
507     public void setFinal(
508             final boolean _final) {
509         this._final = _final;
510         this._has_final = true;
511     }
512 
513     /**
514      * 
515      * 
516      * @param index
517      * @param vImplements
518      * @throws java.lang.IndexOutOfBoundsException if the index
519      * given is outside the bounds of the collection
520      */
521     public void setImplements(
522             final int index,
523             final java.lang.String vImplements)
524     throws java.lang.IndexOutOfBoundsException {
525         // check bounds for index
526         if (index < 0 || index >= this._implementsList.size()) {
527             throw new IndexOutOfBoundsException("setImplements: Index value '" + index + "' not in range [0.." + (this._implementsList.size() - 1) + "]");
528         }
529 
530         this._implementsList.set(index, vImplements);
531     }
532 
533     /**
534      * 
535      * 
536      * @param vImplementsArray
537      */
538     public void setImplements(
539             final java.lang.String[] vImplementsArray) {
540         //-- copy array
541         _implementsList.clear();
542 
543         for (int i = 0; i < vImplementsArray.length; i++) {
544                 this._implementsList.add(vImplementsArray[i]);
545         }
546     }
547 
548     /**
549      * Sets the value of field 'name'.
550      * 
551      * @param name the value of field 'name'.
552      */
553     public void setName(
554             final java.lang.String name) {
555         this._name = name;
556     }
557 
558     /**
559      * Sets the value of field 'package'.
560      * 
561      * @param _package
562      * @param package the value of field 'package'.
563      */
564     public void setPackage(
565             final java.lang.String _package) {
566         this._package = _package;
567     }
568 
569     /**
570      * Method unmarshalClassType.
571      * 
572      * @param reader
573      * @throws org.exolab.castor.xml.MarshalException if object is
574      * null or if any SAXException is thrown during marshaling
575      * @throws org.exolab.castor.xml.ValidationException if this
576      * object is an invalid instance according to the schema
577      * @return the unmarshaled
578      * org.exolab.castor.builder.binding.xml.ClassType
579      */
580     public static org.exolab.castor.builder.binding.xml.ClassType unmarshalClassType(
581             final java.io.Reader reader)
582     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
583         return (org.exolab.castor.builder.binding.xml.ClassType) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.builder.binding.xml.ClassType.class, reader);
584     }
585 
586     /**
587      * 
588      * 
589      * @throws org.exolab.castor.xml.ValidationException if this
590      * object is an invalid instance according to the schema
591      */
592     public void validate(
593     )
594     throws org.exolab.castor.xml.ValidationException {
595         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
596         validator.validate(this);
597     }
598 
599 }