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 CacheTypeMapping implements java.io.Serializable {
17
18
19
20
21
22
23
24
25
26 private java.lang.String _type = "count-limited";
27
28
29
30
31 private boolean _debug = false;
32
33
34
35
36 private boolean _has_debug;
37
38
39
40
41 private long _capacity;
42
43
44
45
46 private boolean _has_capacity;
47
48
49
50
51 private java.util.List<org.exolab.castor.mapping.xml.Param> _paramList;
52
53
54
55
56
57
58 public CacheTypeMapping() {
59 super();
60 setType("count-limited");
61 this._paramList = new java.util.ArrayList<org.exolab.castor.mapping.xml.Param>();
62 }
63
64
65
66
67
68
69
70
71
72
73
74
75
76 public void addParam(
77 final org.exolab.castor.mapping.xml.Param vParam)
78 throws java.lang.IndexOutOfBoundsException {
79 this._paramList.add(vParam);
80 }
81
82
83
84
85
86
87
88
89
90 public void addParam(
91 final int index,
92 final org.exolab.castor.mapping.xml.Param vParam)
93 throws java.lang.IndexOutOfBoundsException {
94 this._paramList.add(index, vParam);
95 }
96
97
98
99 public void deleteCapacity(
100 ) {
101 this._has_capacity= false;
102 }
103
104
105
106 public void deleteDebug(
107 ) {
108 this._has_debug= false;
109 }
110
111
112
113
114
115
116
117 public java.util.Enumeration<? extends org.exolab.castor.mapping.xml.Param> enumerateParam(
118 ) {
119 return java.util.Collections.enumeration(this._paramList);
120 }
121
122
123
124
125
126
127 public long getCapacity(
128 ) {
129 return this._capacity;
130 }
131
132
133
134
135
136
137 public boolean getDebug(
138 ) {
139 return this._debug;
140 }
141
142
143
144
145
146
147
148
149
150
151 public org.exolab.castor.mapping.xml.Param getParam(
152 final int index)
153 throws java.lang.IndexOutOfBoundsException {
154
155 if (index < 0 || index >= this._paramList.size()) {
156 throw new IndexOutOfBoundsException("getParam: Index value '" + index + "' not in range [0.." + (this._paramList.size() - 1) + "]");
157 }
158
159 return (org.exolab.castor.mapping.xml.Param) _paramList.get(index);
160 }
161
162
163
164
165
166
167
168
169
170
171 public org.exolab.castor.mapping.xml.Param[] getParam(
172 ) {
173 org.exolab.castor.mapping.xml.Param[] array = new org.exolab.castor.mapping.xml.Param[0];
174 return (org.exolab.castor.mapping.xml.Param[]) this._paramList.toArray(array);
175 }
176
177
178
179
180
181
182 public int getParamCount(
183 ) {
184 return this._paramList.size();
185 }
186
187
188
189
190
191
192 public java.lang.String getType(
193 ) {
194 return this._type;
195 }
196
197
198
199
200
201
202 public boolean hasCapacity(
203 ) {
204 return this._has_capacity;
205 }
206
207
208
209
210
211
212 public boolean hasDebug(
213 ) {
214 return this._has_debug;
215 }
216
217
218
219
220
221
222 public boolean isDebug(
223 ) {
224 return this._debug;
225 }
226
227
228
229
230
231
232 public boolean isValid(
233 ) {
234 try {
235 validate();
236 } catch (org.exolab.castor.xml.ValidationException vex) {
237 return false;
238 }
239 return true;
240 }
241
242
243
244
245
246
247
248 public java.util.Iterator<? extends org.exolab.castor.mapping.xml.Param> iterateParam(
249 ) {
250 return this._paramList.iterator();
251 }
252
253
254
255
256
257
258
259
260
261
262 public void marshal(
263 final java.io.Writer out)
264 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
265 org.exolab.castor.xml.Marshaller.marshal(this, out);
266 }
267
268
269
270
271
272
273
274
275
276
277
278
279 public void marshal(
280 final org.xml.sax.ContentHandler handler)
281 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
282 org.exolab.castor.xml.Marshaller.marshal(this, handler);
283 }
284
285
286
287 public void removeAllParam(
288 ) {
289 this._paramList.clear();
290 }
291
292
293
294
295
296
297
298 public boolean removeParam(
299 final org.exolab.castor.mapping.xml.Param vParam) {
300 boolean removed = _paramList.remove(vParam);
301 return removed;
302 }
303
304
305
306
307
308
309
310 public org.exolab.castor.mapping.xml.Param removeParamAt(
311 final int index) {
312 java.lang.Object obj = this._paramList.remove(index);
313 return (org.exolab.castor.mapping.xml.Param) obj;
314 }
315
316
317
318
319
320
321 public void setCapacity(
322 final long capacity) {
323 this._capacity = capacity;
324 this._has_capacity = true;
325 }
326
327
328
329
330
331
332 public void setDebug(
333 final boolean debug) {
334 this._debug = debug;
335 this._has_debug = true;
336 }
337
338
339
340
341
342
343
344
345
346 public void setParam(
347 final int index,
348 final org.exolab.castor.mapping.xml.Param vParam)
349 throws java.lang.IndexOutOfBoundsException {
350
351 if (index < 0 || index >= this._paramList.size()) {
352 throw new IndexOutOfBoundsException("setParam: Index value '" + index + "' not in range [0.." + (this._paramList.size() - 1) + "]");
353 }
354
355 this._paramList.set(index, vParam);
356 }
357
358
359
360
361
362
363 public void setParam(
364 final org.exolab.castor.mapping.xml.Param[] vParamArray) {
365
366 _paramList.clear();
367
368 for (int i = 0; i < vParamArray.length; i++) {
369 this._paramList.add(vParamArray[i]);
370 }
371 }
372
373
374
375
376
377
378 public void setType(
379 final java.lang.String type) {
380 this._type = type;
381 }
382
383
384
385
386
387
388
389
390
391
392
393
394 public static org.exolab.castor.mapping.xml.CacheTypeMapping unmarshal(
395 final java.io.Reader reader)
396 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
397 return (org.exolab.castor.mapping.xml.CacheTypeMapping) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.CacheTypeMapping.class, reader);
398 }
399
400
401
402
403
404
405
406 public void validate(
407 )
408 throws org.exolab.castor.xml.ValidationException {
409 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
410 validator.validate(this);
411 }
412
413 }