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