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