1
2
3
4
5
6
7
8 package org.exolab.castor.mapping.xml;
9
10
11
12
13
14
15 @SuppressWarnings("serial")
16 public class NamedNativeQuery implements java.io.Serializable {
17
18
19
20
21
22
23
24
25
26 private java.lang.String _name;
27
28
29
30
31 private java.lang.String _resultClass;
32
33
34
35
36 private java.lang.String _resultSetMapping;
37
38
39
40
41 private java.lang.String _query;
42
43
44
45
46 private java.util.List<org.exolab.castor.mapping.xml.QueryHint> _queryHintList;
47
48
49
50
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
61
62
63
64
65
66
67
68
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
80
81
82
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
93
94
95
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
104
105
106
107 public java.lang.String getName(
108 ) {
109 return this._name;
110 }
111
112
113
114
115
116
117 public java.lang.String getQuery(
118 ) {
119 return this._query;
120 }
121
122
123
124
125
126
127
128
129
130
131 public org.exolab.castor.mapping.xml.QueryHint getQueryHint(
132 final int index)
133 throws java.lang.IndexOutOfBoundsException {
134
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
144
145
146
147
148
149
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
159
160
161
162 public int getQueryHintCount(
163 ) {
164 return this._queryHintList.size();
165 }
166
167
168
169
170
171
172 public java.lang.String getResultClass(
173 ) {
174 return this._resultClass;
175 }
176
177
178
179
180
181
182 public java.lang.String getResultSetMapping(
183 ) {
184 return this._resultSetMapping;
185 }
186
187
188
189
190
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
204
205
206
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
217
218
219
220
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
232
233
234
235
236
237
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
254
255
256
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
266
267
268
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
278
279
280
281 public void setName(
282 final java.lang.String name) {
283 this._name = name;
284 }
285
286
287
288
289
290
291 public void setQuery(
292 final java.lang.String query) {
293 this._query = query;
294 }
295
296
297
298
299
300
301
302
303
304 public void setQueryHint(
305 final int index,
306 final org.exolab.castor.mapping.xml.QueryHint vQueryHint)
307 throws java.lang.IndexOutOfBoundsException {
308
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
320
321 public void setQueryHint(
322 final org.exolab.castor.mapping.xml.QueryHint[] vQueryHintArray) {
323
324 _queryHintList.clear();
325
326 for (int i = 0; i < vQueryHintArray.length; i++) {
327 this._queryHintList.add(vQueryHintArray[i]);
328 }
329 }
330
331
332
333
334
335
336 public void setResultClass(
337 final java.lang.String resultClass) {
338 this._resultClass = resultClass;
339 }
340
341
342
343
344
345
346 public void setResultSetMapping(
347 final java.lang.String resultSetMapping) {
348 this._resultSetMapping = resultSetMapping;
349 }
350
351
352
353
354
355
356
357
358
359
360
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
372
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 }