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   * Class KeyGeneratorDef.
12   * 
13   * @version $Revision$ $Date$
14   */
15  @SuppressWarnings("serial")
16  public class KeyGeneratorDef implements java.io.Serializable {
17  
18  
19        //--------------------------/
20       //- Class/Member Variables -/
21      //--------------------------/
22  
23      /**
24       * Field _name.
25       */
26      private java.lang.String _name;
27  
28      /**
29       * Field _alias.
30       */
31      private java.lang.String _alias;
32  
33      /**
34       * Field _paramList.
35       */
36      private java.util.List<org.exolab.castor.mapping.xml.Param> _paramList;
37  
38  
39        //----------------/
40       //- Constructors -/
41      //----------------/
42  
43      public KeyGeneratorDef() {
44          super();
45          this._paramList = new java.util.ArrayList<org.exolab.castor.mapping.xml.Param>();
46      }
47  
48  
49        //-----------/
50       //- Methods -/
51      //-----------/
52  
53      /**
54       * 
55       * 
56       * @param vParam
57       * @throws java.lang.IndexOutOfBoundsException if the index
58       * given is outside the bounds of the collection
59       */
60      public void addParam(
61              final org.exolab.castor.mapping.xml.Param vParam)
62      throws java.lang.IndexOutOfBoundsException {
63          this._paramList.add(vParam);
64      }
65  
66      /**
67       * 
68       * 
69       * @param index
70       * @param vParam
71       * @throws java.lang.IndexOutOfBoundsException if the index
72       * given is outside the bounds of the collection
73       */
74      public void addParam(
75              final int index,
76              final org.exolab.castor.mapping.xml.Param vParam)
77      throws java.lang.IndexOutOfBoundsException {
78          this._paramList.add(index, vParam);
79      }
80  
81      /**
82       * Method enumerateParam.
83       * 
84       * @return an Enumeration over all possible elements of this
85       * collection
86       */
87      public java.util.Enumeration<? extends org.exolab.castor.mapping.xml.Param> enumerateParam(
88      ) {
89          return java.util.Collections.enumeration(this._paramList);
90      }
91  
92      /**
93       * Returns the value of field 'alias'.
94       * 
95       * @return the value of field 'Alias'.
96       */
97      public java.lang.String getAlias(
98      ) {
99          return this._alias;
100     }
101 
102     /**
103      * Returns the value of field 'name'.
104      * 
105      * @return the value of field 'Name'.
106      */
107     public java.lang.String getName(
108     ) {
109         return this._name;
110     }
111 
112     /**
113      * Method getParam.
114      * 
115      * @param index
116      * @throws java.lang.IndexOutOfBoundsException if the index
117      * given is outside the bounds of the collection
118      * @return the value of the org.exolab.castor.mapping.xml.Param
119      * at the given index
120      */
121     public org.exolab.castor.mapping.xml.Param getParam(
122             final int index)
123     throws java.lang.IndexOutOfBoundsException {
124         // check bounds for index
125         if (index < 0 || index >= this._paramList.size()) {
126             throw new IndexOutOfBoundsException("getParam: Index value '" + index + "' not in range [0.." + (this._paramList.size() - 1) + "]");
127         }
128 
129         return (org.exolab.castor.mapping.xml.Param) _paramList.get(index);
130     }
131 
132     /**
133      * Method getParam.Returns the contents of the collection in an
134      * Array.  <p>Note:  Just in case the collection contents are
135      * changing in another thread, we pass a 0-length Array of the
136      * correct type into the API call.  This way we <i>know</i>
137      * that the Array returned is of exactly the correct length.
138      * 
139      * @return this collection as an Array
140      */
141     public org.exolab.castor.mapping.xml.Param[] getParam(
142     ) {
143         org.exolab.castor.mapping.xml.Param[] array = new org.exolab.castor.mapping.xml.Param[0];
144         return (org.exolab.castor.mapping.xml.Param[]) this._paramList.toArray(array);
145     }
146 
147     /**
148      * Method getParamCount.
149      * 
150      * @return the size of this collection
151      */
152     public int getParamCount(
153     ) {
154         return this._paramList.size();
155     }
156 
157     /**
158      * Method isValid.
159      * 
160      * @return true if this object is valid according to the schema
161      */
162     public boolean isValid(
163     ) {
164         try {
165             validate();
166         } catch (org.exolab.castor.xml.ValidationException vex) {
167             return false;
168         }
169         return true;
170     }
171 
172     /**
173      * Method iterateParam.
174      * 
175      * @return an Iterator over all possible elements in this
176      * collection
177      */
178     public java.util.Iterator<? extends org.exolab.castor.mapping.xml.Param> iterateParam(
179     ) {
180         return this._paramList.iterator();
181     }
182 
183     /**
184      * 
185      * 
186      * @param out
187      * @throws org.exolab.castor.xml.MarshalException if object is
188      * null or if any SAXException is thrown during marshaling
189      * @throws org.exolab.castor.xml.ValidationException if this
190      * object is an invalid instance according to the schema
191      */
192     public void marshal(
193             final java.io.Writer out)
194     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
195         org.exolab.castor.xml.Marshaller.marshal(this, out);
196     }
197 
198     /**
199      * 
200      * 
201      * @param handler
202      * @throws java.io.IOException if an IOException occurs during
203      * marshaling
204      * @throws org.exolab.castor.xml.ValidationException if this
205      * object is an invalid instance according to the schema
206      * @throws org.exolab.castor.xml.MarshalException if object is
207      * null or if any SAXException is thrown during marshaling
208      */
209     public void marshal(
210             final org.xml.sax.ContentHandler handler)
211     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
212         org.exolab.castor.xml.Marshaller.marshal(this, handler);
213     }
214 
215     /**
216      */
217     public void removeAllParam(
218     ) {
219         this._paramList.clear();
220     }
221 
222     /**
223      * Method removeParam.
224      * 
225      * @param vParam
226      * @return true if the object was removed from the collection.
227      */
228     public boolean removeParam(
229             final org.exolab.castor.mapping.xml.Param vParam) {
230         boolean removed = _paramList.remove(vParam);
231         return removed;
232     }
233 
234     /**
235      * Method removeParamAt.
236      * 
237      * @param index
238      * @return the element removed from the collection
239      */
240     public org.exolab.castor.mapping.xml.Param removeParamAt(
241             final int index) {
242         java.lang.Object obj = this._paramList.remove(index);
243         return (org.exolab.castor.mapping.xml.Param) obj;
244     }
245 
246     /**
247      * Sets the value of field 'alias'.
248      * 
249      * @param alias the value of field 'alias'.
250      */
251     public void setAlias(
252             final java.lang.String alias) {
253         this._alias = alias;
254     }
255 
256     /**
257      * Sets the value of field 'name'.
258      * 
259      * @param name the value of field 'name'.
260      */
261     public void setName(
262             final java.lang.String name) {
263         this._name = name;
264     }
265 
266     /**
267      * 
268      * 
269      * @param index
270      * @param vParam
271      * @throws java.lang.IndexOutOfBoundsException if the index
272      * given is outside the bounds of the collection
273      */
274     public void setParam(
275             final int index,
276             final org.exolab.castor.mapping.xml.Param vParam)
277     throws java.lang.IndexOutOfBoundsException {
278         // check bounds for index
279         if (index < 0 || index >= this._paramList.size()) {
280             throw new IndexOutOfBoundsException("setParam: Index value '" + index + "' not in range [0.." + (this._paramList.size() - 1) + "]");
281         }
282 
283         this._paramList.set(index, vParam);
284     }
285 
286     /**
287      * 
288      * 
289      * @param vParamArray
290      */
291     public void setParam(
292             final org.exolab.castor.mapping.xml.Param[] vParamArray) {
293         //-- copy array
294         _paramList.clear();
295 
296         for (int i = 0; i < vParamArray.length; i++) {
297                 this._paramList.add(vParamArray[i]);
298         }
299     }
300 
301     /**
302      * Method unmarshal.
303      * 
304      * @param reader
305      * @throws org.exolab.castor.xml.MarshalException if object is
306      * null or if any SAXException is thrown during marshaling
307      * @throws org.exolab.castor.xml.ValidationException if this
308      * object is an invalid instance according to the schema
309      * @return the unmarshaled
310      * org.exolab.castor.mapping.xml.KeyGeneratorDef
311      */
312     public static org.exolab.castor.mapping.xml.KeyGeneratorDef unmarshal(
313             final java.io.Reader reader)
314     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
315         return (org.exolab.castor.mapping.xml.KeyGeneratorDef) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.KeyGeneratorDef.class, reader);
316     }
317 
318     /**
319      * 
320      * 
321      * @throws org.exolab.castor.xml.ValidationException if this
322      * object is an invalid instance according to the schema
323      */
324     public void validate(
325     )
326     throws org.exolab.castor.xml.ValidationException {
327         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
328         validator.validate(this);
329     }
330 
331 }