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 NamedNativeQuery.
12   * 
13   * @version $Revision$ $Date$
14   */
15  @SuppressWarnings("serial")
16  public class NamedNativeQuery 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 _resultClass.
30       */
31      private java.lang.String _resultClass;
32  
33      /**
34       * Field _resultSetMapping.
35       */
36      private java.lang.String _resultSetMapping;
37  
38      /**
39       * Field _query.
40       */
41      private java.lang.String _query;
42  
43      /**
44       * Field _queryHintList.
45       */
46      private java.util.List<org.exolab.castor.mapping.xml.QueryHint> _queryHintList;
47  
48  
49        //----------------/
50       //- Constructors -/
51      //----------------/
52  
53      public NamedNativeQuery() {
54          super();
55          this._queryHintList = new java.util.ArrayList<org.exolab.castor.mapping.xml.QueryHint>();
56      }
57  
58  
59        //-----------/
60       //- Methods -/
61      //-----------/
62  
63      /**
64       * 
65       * 
66       * @param vQueryHint
67       * @throws java.lang.IndexOutOfBoundsException if the index
68       * given is outside the bounds of the collection
69       */
70      public void addQueryHint(
71              final org.exolab.castor.mapping.xml.QueryHint vQueryHint)
72      throws java.lang.IndexOutOfBoundsException {
73          this._queryHintList.add(vQueryHint);
74      }
75  
76      /**
77       * 
78       * 
79       * @param index
80       * @param vQueryHint
81       * @throws java.lang.IndexOutOfBoundsException if the index
82       * given is outside the bounds of the collection
83       */
84      public void addQueryHint(
85              final int index,
86              final org.exolab.castor.mapping.xml.QueryHint vQueryHint)
87      throws java.lang.IndexOutOfBoundsException {
88          this._queryHintList.add(index, vQueryHint);
89      }
90  
91      /**
92       * Method enumerateQueryHint.
93       * 
94       * @return an Enumeration over all possible elements of this
95       * collection
96       */
97      public java.util.Enumeration<? extends org.exolab.castor.mapping.xml.QueryHint> enumerateQueryHint(
98      ) {
99          return java.util.Collections.enumeration(this._queryHintList);
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      * Returns the value of field 'query'.
114      * 
115      * @return the value of field 'Query'.
116      */
117     public java.lang.String getQuery(
118     ) {
119         return this._query;
120     }
121 
122     /**
123      * Method getQueryHint.
124      * 
125      * @param index
126      * @throws java.lang.IndexOutOfBoundsException if the index
127      * given is outside the bounds of the collection
128      * @return the value of the
129      * org.exolab.castor.mapping.xml.QueryHint at the given index
130      */
131     public org.exolab.castor.mapping.xml.QueryHint getQueryHint(
132             final int index)
133     throws java.lang.IndexOutOfBoundsException {
134         // check bounds for index
135         if (index < 0 || index >= this._queryHintList.size()) {
136             throw new IndexOutOfBoundsException("getQueryHint: Index value '" + index + "' not in range [0.." + (this._queryHintList.size() - 1) + "]");
137         }
138 
139         return (org.exolab.castor.mapping.xml.QueryHint) _queryHintList.get(index);
140     }
141 
142     /**
143      * Method getQueryHint.Returns the contents of the collection
144      * in an Array.  <p>Note:  Just in case the collection contents
145      * are changing in another thread, we pass a 0-length Array of
146      * the correct type into the API call.  This way we <i>know</i>
147      * that the Array returned is of exactly the correct length.
148      * 
149      * @return this collection as an Array
150      */
151     public org.exolab.castor.mapping.xml.QueryHint[] getQueryHint(
152     ) {
153         org.exolab.castor.mapping.xml.QueryHint[] array = new org.exolab.castor.mapping.xml.QueryHint[0];
154         return (org.exolab.castor.mapping.xml.QueryHint[]) this._queryHintList.toArray(array);
155     }
156 
157     /**
158      * Method getQueryHintCount.
159      * 
160      * @return the size of this collection
161      */
162     public int getQueryHintCount(
163     ) {
164         return this._queryHintList.size();
165     }
166 
167     /**
168      * Returns the value of field 'resultClass'.
169      * 
170      * @return the value of field 'ResultClass'.
171      */
172     public java.lang.String getResultClass(
173     ) {
174         return this._resultClass;
175     }
176 
177     /**
178      * Returns the value of field 'resultSetMapping'.
179      * 
180      * @return the value of field 'ResultSetMapping'.
181      */
182     public java.lang.String getResultSetMapping(
183     ) {
184         return this._resultSetMapping;
185     }
186 
187     /**
188      * Method isValid.
189      * 
190      * @return true if this object is valid according to the schema
191      */
192     public boolean isValid(
193     ) {
194         try {
195             validate();
196         } catch (org.exolab.castor.xml.ValidationException vex) {
197             return false;
198         }
199         return true;
200     }
201 
202     /**
203      * Method iterateQueryHint.
204      * 
205      * @return an Iterator over all possible elements in this
206      * collection
207      */
208     public java.util.Iterator<? extends org.exolab.castor.mapping.xml.QueryHint> iterateQueryHint(
209     ) {
210         return this._queryHintList.iterator();
211     }
212 
213     /**
214      * 
215      * 
216      * @param out
217      * @throws org.exolab.castor.xml.MarshalException if object is
218      * null or if any SAXException is thrown during marshaling
219      * @throws org.exolab.castor.xml.ValidationException if this
220      * object is an invalid instance according to the schema
221      */
222     public void marshal(
223             final java.io.Writer out)
224     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
225         org.exolab.castor.xml.Marshaller.marshal(this, out);
226     }
227 
228     /**
229      * 
230      * 
231      * @param handler
232      * @throws java.io.IOException if an IOException occurs during
233      * marshaling
234      * @throws org.exolab.castor.xml.ValidationException if this
235      * object is an invalid instance according to the schema
236      * @throws org.exolab.castor.xml.MarshalException if object is
237      * null or if any SAXException is thrown during marshaling
238      */
239     public void marshal(
240             final org.xml.sax.ContentHandler handler)
241     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
242         org.exolab.castor.xml.Marshaller.marshal(this, handler);
243     }
244 
245     /**
246      */
247     public void removeAllQueryHint(
248     ) {
249         this._queryHintList.clear();
250     }
251 
252     /**
253      * Method removeQueryHint.
254      * 
255      * @param vQueryHint
256      * @return true if the object was removed from the collection.
257      */
258     public boolean removeQueryHint(
259             final org.exolab.castor.mapping.xml.QueryHint vQueryHint) {
260         boolean removed = _queryHintList.remove(vQueryHint);
261         return removed;
262     }
263 
264     /**
265      * Method removeQueryHintAt.
266      * 
267      * @param index
268      * @return the element removed from the collection
269      */
270     public org.exolab.castor.mapping.xml.QueryHint removeQueryHintAt(
271             final int index) {
272         java.lang.Object obj = this._queryHintList.remove(index);
273         return (org.exolab.castor.mapping.xml.QueryHint) obj;
274     }
275 
276     /**
277      * Sets the value of field 'name'.
278      * 
279      * @param name the value of field 'name'.
280      */
281     public void setName(
282             final java.lang.String name) {
283         this._name = name;
284     }
285 
286     /**
287      * Sets the value of field 'query'.
288      * 
289      * @param query the value of field 'query'.
290      */
291     public void setQuery(
292             final java.lang.String query) {
293         this._query = query;
294     }
295 
296     /**
297      * 
298      * 
299      * @param index
300      * @param vQueryHint
301      * @throws java.lang.IndexOutOfBoundsException if the index
302      * given is outside the bounds of the collection
303      */
304     public void setQueryHint(
305             final int index,
306             final org.exolab.castor.mapping.xml.QueryHint vQueryHint)
307     throws java.lang.IndexOutOfBoundsException {
308         // check bounds for index
309         if (index < 0 || index >= this._queryHintList.size()) {
310             throw new IndexOutOfBoundsException("setQueryHint: Index value '" + index + "' not in range [0.." + (this._queryHintList.size() - 1) + "]");
311         }
312 
313         this._queryHintList.set(index, vQueryHint);
314     }
315 
316     /**
317      * 
318      * 
319      * @param vQueryHintArray
320      */
321     public void setQueryHint(
322             final org.exolab.castor.mapping.xml.QueryHint[] vQueryHintArray) {
323         //-- copy array
324         _queryHintList.clear();
325 
326         for (int i = 0; i < vQueryHintArray.length; i++) {
327                 this._queryHintList.add(vQueryHintArray[i]);
328         }
329     }
330 
331     /**
332      * Sets the value of field 'resultClass'.
333      * 
334      * @param resultClass the value of field 'resultClass'.
335      */
336     public void setResultClass(
337             final java.lang.String resultClass) {
338         this._resultClass = resultClass;
339     }
340 
341     /**
342      * Sets the value of field 'resultSetMapping'.
343      * 
344      * @param resultSetMapping the value of field 'resultSetMapping'
345      */
346     public void setResultSetMapping(
347             final java.lang.String resultSetMapping) {
348         this._resultSetMapping = resultSetMapping;
349     }
350 
351     /**
352      * Method unmarshal.
353      * 
354      * @param reader
355      * @throws org.exolab.castor.xml.MarshalException if object is
356      * null or if any SAXException is thrown during marshaling
357      * @throws org.exolab.castor.xml.ValidationException if this
358      * object is an invalid instance according to the schema
359      * @return the unmarshaled
360      * org.exolab.castor.mapping.xml.NamedNativeQuery
361      */
362     public static org.exolab.castor.mapping.xml.NamedNativeQuery unmarshal(
363             final java.io.Reader reader)
364     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
365         return (org.exolab.castor.mapping.xml.NamedNativeQuery) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.NamedNativeQuery.class, reader);
366     }
367 
368     /**
369      * 
370      * 
371      * @throws org.exolab.castor.xml.ValidationException if this
372      * object is an invalid instance according to the schema
373      */
374     public void validate(
375     )
376     throws org.exolab.castor.xml.ValidationException {
377         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
378         validator.validate(this);
379     }
380 
381 }