1
2
3
4
5
6
7
8 package org.exolab.castor.xml.schema.annotations.jdo;
9
10
11
12
13
14
15 @SuppressWarnings("serial")
16 public class PkType implements java.io.Serializable {
17
18
19
20
21
22
23
24
25
26 private java.util.List<java.lang.String> _keyList;
27
28
29
30
31
32
33 public PkType() {
34 super();
35 this._keyList = new java.util.ArrayList<java.lang.String>();
36 }
37
38
39
40
41
42
43
44
45
46
47
48
49
50 public void addKey(
51 final java.lang.String vKey)
52 throws java.lang.IndexOutOfBoundsException {
53 this._keyList.add(vKey);
54 }
55
56
57
58
59
60
61
62
63
64 public void addKey(
65 final int index,
66 final java.lang.String vKey)
67 throws java.lang.IndexOutOfBoundsException {
68 this._keyList.add(index, vKey);
69 }
70
71
72
73
74
75
76
77 public java.util.Enumeration<? extends java.lang.String> enumerateKey(
78 ) {
79 return java.util.Collections.enumeration(this._keyList);
80 }
81
82
83
84
85
86
87
88
89
90 public java.lang.String getKey(
91 final int index)
92 throws java.lang.IndexOutOfBoundsException {
93
94 if (index < 0 || index >= this._keyList.size()) {
95 throw new IndexOutOfBoundsException("getKey: Index value '" + index + "' not in range [0.." + (this._keyList.size() - 1) + "]");
96 }
97
98 return (java.lang.String) _keyList.get(index);
99 }
100
101
102
103
104
105
106
107
108
109
110 public java.lang.String[] getKey(
111 ) {
112 java.lang.String[] array = new java.lang.String[0];
113 return (java.lang.String[]) this._keyList.toArray(array);
114 }
115
116
117
118
119
120
121 public int getKeyCount(
122 ) {
123 return this._keyList.size();
124 }
125
126
127
128
129
130
131 public boolean isValid(
132 ) {
133 try {
134 validate();
135 } catch (org.exolab.castor.xml.ValidationException vex) {
136 return false;
137 }
138 return true;
139 }
140
141
142
143
144
145
146
147 public java.util.Iterator<? extends java.lang.String> iterateKey(
148 ) {
149 return this._keyList.iterator();
150 }
151
152
153
154
155
156
157
158
159
160
161 public void marshal(
162 final java.io.Writer out)
163 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
164 org.exolab.castor.xml.Marshaller.marshal(this, out);
165 }
166
167
168
169
170
171
172
173
174
175
176
177
178 public void marshal(
179 final org.xml.sax.ContentHandler handler)
180 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
181 org.exolab.castor.xml.Marshaller.marshal(this, handler);
182 }
183
184
185
186 public void removeAllKey(
187 ) {
188 this._keyList.clear();
189 }
190
191
192
193
194
195
196
197 public boolean removeKey(
198 final java.lang.String vKey) {
199 boolean removed = _keyList.remove(vKey);
200 return removed;
201 }
202
203
204
205
206
207
208
209 public java.lang.String removeKeyAt(
210 final int index) {
211 java.lang.Object obj = this._keyList.remove(index);
212 return (java.lang.String) obj;
213 }
214
215
216
217
218
219
220
221
222
223 public void setKey(
224 final int index,
225 final java.lang.String vKey)
226 throws java.lang.IndexOutOfBoundsException {
227
228 if (index < 0 || index >= this._keyList.size()) {
229 throw new IndexOutOfBoundsException("setKey: Index value '" + index + "' not in range [0.." + (this._keyList.size() - 1) + "]");
230 }
231
232 this._keyList.set(index, vKey);
233 }
234
235
236
237
238
239
240 public void setKey(
241 final java.lang.String[] vKeyArray) {
242
243 _keyList.clear();
244
245 for (int i = 0; i < vKeyArray.length; i++) {
246 this._keyList.add(vKeyArray[i]);
247 }
248 }
249
250
251
252
253
254
255
256
257
258
259
260
261 public static org.exolab.castor.xml.schema.annotations.jdo.PkType unmarshal(
262 final java.io.Reader reader)
263 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
264 return (org.exolab.castor.xml.schema.annotations.jdo.PkType) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.xml.schema.annotations.jdo.PkType.class, reader);
265 }
266
267
268
269
270
271
272
273 public void validate(
274 )
275 throws org.exolab.castor.xml.ValidationException {
276 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
277 validator.validate(this);
278 }
279
280 }