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 NamedQuery 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 _query;
32
33
34
35
36 private java.util.List<org.exolab.castor.mapping.xml.QueryHint> _queryHintList;
37
38
39
40
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
51
52
53
54
55
56
57
58
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
70
71
72
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
83
84
85
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
94
95
96
97 public java.lang.String getName(
98 ) {
99 return this._name;
100 }
101
102
103
104
105
106
107 public java.lang.String getQuery(
108 ) {
109 return this._query;
110 }
111
112
113
114
115
116
117
118
119
120
121 public org.exolab.castor.mapping.xml.QueryHint getQueryHint(
122 final int index)
123 throws java.lang.IndexOutOfBoundsException {
124
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
134
135
136
137
138
139
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
149
150
151
152 public int getQueryHintCount(
153 ) {
154 return this._queryHintList.size();
155 }
156
157
158
159
160
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
174
175
176
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
187
188
189
190
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
202
203
204
205
206
207
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
224
225
226
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
236
237
238
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
248
249
250
251 public void setName(
252 final java.lang.String name) {
253 this._name = name;
254 }
255
256
257
258
259
260
261 public void setQuery(
262 final java.lang.String query) {
263 this._query = query;
264 }
265
266
267
268
269
270
271
272
273
274 public void setQueryHint(
275 final int index,
276 final org.exolab.castor.mapping.xml.QueryHint vQueryHint)
277 throws java.lang.IndexOutOfBoundsException {
278
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
290
291 public void setQueryHint(
292 final org.exolab.castor.mapping.xml.QueryHint[] vQueryHintArray) {
293
294 _queryHintList.clear();
295
296 for (int i = 0; i < vQueryHintArray.length; i++) {
297 this._queryHintList.add(vQueryHintArray[i]);
298 }
299 }
300
301
302
303
304
305
306
307
308
309
310
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
322
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 }