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 NamedQuery.
12   * 
13   * @version $Revision$ $Date$
14   */
15  @SuppressWarnings("serial")
16  public class NamedQuery 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 _query.
30       */
31      private java.lang.String _query;
32  
33      /**
34       * Field _queryHintList.
35       */
36      private java.util.List<org.exolab.castor.mapping.xml.QueryHint> _queryHintList;
37  
38  
39        //----------------/
40       //- Constructors -/
41      //----------------/
42  
43      public NamedQuery() {
44          super();
45          this._queryHintList = new java.util.ArrayList<org.exolab.castor.mapping.xml.QueryHint>();
46      }
47  
48  
49        //-----------/
50       //- Methods -/
51      //-----------/
52  
53      /**
54       * 
55       * 
56       * @param vQueryHint
57       * @throws java.lang.IndexOutOfBoundsException if the index
58       * given is outside the bounds of the collection
59       */
60      public void addQueryHint(
61              final org.exolab.castor.mapping.xml.QueryHint vQueryHint)
62      throws java.lang.IndexOutOfBoundsException {
63          this._queryHintList.add(vQueryHint);
64      }
65  
66      /**
67       * 
68       * 
69       * @param index
70       * @param vQueryHint
71       * @throws java.lang.IndexOutOfBoundsException if the index
72       * given is outside the bounds of the collection
73       */
74      public void addQueryHint(
75              final int index,
76              final org.exolab.castor.mapping.xml.QueryHint vQueryHint)
77      throws java.lang.IndexOutOfBoundsException {
78          this._queryHintList.add(index, vQueryHint);
79      }
80  
81      /**
82       * Method enumerateQueryHint.
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.QueryHint> enumerateQueryHint(
88      ) {
89          return java.util.Collections.enumeration(this._queryHintList);
90      }
91  
92      /**
93       * Returns the value of field 'name'.
94       * 
95       * @return the value of field 'Name'.
96       */
97      public java.lang.String getName(
98      ) {
99          return this._name;
100     }
101 
102     /**
103      * Returns the value of field 'query'.
104      * 
105      * @return the value of field 'Query'.
106      */
107     public java.lang.String getQuery(
108     ) {
109         return this._query;
110     }
111 
112     /**
113      * Method getQueryHint.
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
119      * org.exolab.castor.mapping.xml.QueryHint at the given index
120      */
121     public org.exolab.castor.mapping.xml.QueryHint getQueryHint(
122             final int index)
123     throws java.lang.IndexOutOfBoundsException {
124         // check bounds for index
125         if (index < 0 || index >= this._queryHintList.size()) {
126             throw new IndexOutOfBoundsException("getQueryHint: Index value '" + index + "' not in range [0.." + (this._queryHintList.size() - 1) + "]");
127         }
128 
129         return (org.exolab.castor.mapping.xml.QueryHint) _queryHintList.get(index);
130     }
131 
132     /**
133      * Method getQueryHint.Returns the contents of the collection
134      * in an Array.  <p>Note:  Just in case the collection contents
135      * are changing in another thread, we pass a 0-length Array of
136      * the 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.QueryHint[] getQueryHint(
142     ) {
143         org.exolab.castor.mapping.xml.QueryHint[] array = new org.exolab.castor.mapping.xml.QueryHint[0];
144         return (org.exolab.castor.mapping.xml.QueryHint[]) this._queryHintList.toArray(array);
145     }
146 
147     /**
148      * Method getQueryHintCount.
149      * 
150      * @return the size of this collection
151      */
152     public int getQueryHintCount(
153     ) {
154         return this._queryHintList.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 iterateQueryHint.
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.QueryHint> iterateQueryHint(
179     ) {
180         return this._queryHintList.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 removeAllQueryHint(
218     ) {
219         this._queryHintList.clear();
220     }
221 
222     /**
223      * Method removeQueryHint.
224      * 
225      * @param vQueryHint
226      * @return true if the object was removed from the collection.
227      */
228     public boolean removeQueryHint(
229             final org.exolab.castor.mapping.xml.QueryHint vQueryHint) {
230         boolean removed = _queryHintList.remove(vQueryHint);
231         return removed;
232     }
233 
234     /**
235      * Method removeQueryHintAt.
236      * 
237      * @param index
238      * @return the element removed from the collection
239      */
240     public org.exolab.castor.mapping.xml.QueryHint removeQueryHintAt(
241             final int index) {
242         java.lang.Object obj = this._queryHintList.remove(index);
243         return (org.exolab.castor.mapping.xml.QueryHint) obj;
244     }
245 
246     /**
247      * Sets the value of field 'name'.
248      * 
249      * @param name the value of field 'name'.
250      */
251     public void setName(
252             final java.lang.String name) {
253         this._name = name;
254     }
255 
256     /**
257      * Sets the value of field 'query'.
258      * 
259      * @param query the value of field 'query'.
260      */
261     public void setQuery(
262             final java.lang.String query) {
263         this._query = query;
264     }
265 
266     /**
267      * 
268      * 
269      * @param index
270      * @param vQueryHint
271      * @throws java.lang.IndexOutOfBoundsException if the index
272      * given is outside the bounds of the collection
273      */
274     public void setQueryHint(
275             final int index,
276             final org.exolab.castor.mapping.xml.QueryHint vQueryHint)
277     throws java.lang.IndexOutOfBoundsException {
278         // check bounds for index
279         if (index < 0 || index >= this._queryHintList.size()) {
280             throw new IndexOutOfBoundsException("setQueryHint: Index value '" + index + "' not in range [0.." + (this._queryHintList.size() - 1) + "]");
281         }
282 
283         this._queryHintList.set(index, vQueryHint);
284     }
285 
286     /**
287      * 
288      * 
289      * @param vQueryHintArray
290      */
291     public void setQueryHint(
292             final org.exolab.castor.mapping.xml.QueryHint[] vQueryHintArray) {
293         //-- copy array
294         _queryHintList.clear();
295 
296         for (int i = 0; i < vQueryHintArray.length; i++) {
297                 this._queryHintList.add(vQueryHintArray[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.NamedQuery
311      */
312     public static org.exolab.castor.mapping.xml.NamedQuery 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.NamedQuery) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.NamedQuery.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 }