1
2
3
4
5
6
7
8
9 package org.jomc.modlet;
10
11 import javax.annotation.Generated;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlSeeAlso;
15 import javax.xml.bind.annotation.XmlType;
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 @XmlAccessorType(XmlAccessType.FIELD)
37 @XmlType(name = "ModletObject", namespace = "http://jomc.org/modlet")
38 @XmlSeeAlso({
39 Schema.class,
40 Services.class,
41 Schemas.class,
42 Model.class,
43 Modlets.class,
44 Modlet.class,
45 Service.class,
46 Property.class
47 })
48 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-06-03T09:42:31+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
49 public class ModletObject implements Cloneable
50 {
51
52
53
54
55
56
57 public ModletObject() {
58
59 super();
60 }
61
62
63
64
65
66
67
68
69
70
71 public ModletObject(final ModletObject o) {
72
73 super();
74 if (o == null) {
75 throw new NullPointerException("Cannot create a copy of 'ModletObject' from 'null'.");
76 }
77 }
78
79
80
81
82
83
84
85
86 @Override
87 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-06-03T09:42:31+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
88 public ModletObject clone() {
89 try {
90 {
91
92 final ModletObject clone = ((ModletObject) super.clone());
93 return clone;
94 }
95 } catch (CloneNotSupportedException e) {
96
97 throw new AssertionError(e);
98 }
99 }
100
101
102 public static final String MODEL_PUBLIC_ID = "http://jomc.org/modlet";
103
104
105
106
107
108 public static final java.net.URI PUBLIC_ID;
109
110 static
111 {
112 try
113 {
114 PUBLIC_ID = new java.net.URI( MODEL_PUBLIC_ID );
115 }
116 catch ( final java.net.URISyntaxException e )
117 {
118 throw new AssertionError( e );
119 }
120 }
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138 @Deprecated
139 protected javax.xml.bind.JAXBElement getAnyElement( final java.util.List<Object> any, final String namespaceURI,
140 final String localPart )
141 {
142 if ( any == null )
143 {
144 throw new NullPointerException( "any" );
145 }
146 if ( namespaceURI == null )
147 {
148 throw new NullPointerException( "namespaceURI" );
149 }
150 if ( localPart == null )
151 {
152 throw new NullPointerException( "localPart" );
153 }
154
155 javax.xml.bind.JAXBElement<?> anyElement = null;
156
157 for ( int i = 0, s0 = any.size(); i < s0; i++ )
158 {
159 final Object o = any.get( i );
160
161 if ( o instanceof javax.xml.bind.JAXBElement<?> )
162 {
163 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
164
165 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
166 && localPart.equals( e.getName().getLocalPart() ) )
167 {
168 if ( anyElement == null )
169 {
170 anyElement = e;
171 }
172 else
173 {
174 throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(),
175 namespaceURI, localPart ) );
176
177 }
178 }
179 }
180 }
181
182 return anyElement;
183 }
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201 @Deprecated
202 protected java.util.List<javax.xml.bind.JAXBElement> getAnyElements( final java.util.List<Object> any,
203 final String namespaceURI,
204 final String localPart )
205 {
206 if ( any == null )
207 {
208 throw new NullPointerException( "any" );
209 }
210 if ( namespaceURI == null )
211 {
212 throw new NullPointerException( "namespaceURI" );
213 }
214 if ( localPart == null )
215 {
216 throw new NullPointerException( "localPart" );
217 }
218
219 final java.util.List<javax.xml.bind.JAXBElement> anyElements =
220 new java.util.ArrayList<javax.xml.bind.JAXBElement>( any.size() );
221
222 for ( int i = 0, s0 = any.size(); i < s0; i++ )
223 {
224 final Object o = any.get( i );
225
226 if ( o instanceof javax.xml.bind.JAXBElement<?> )
227 {
228 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
229
230 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
231 && localPart.equals( e.getName().getLocalPart() ) )
232 {
233 anyElements.add( e );
234 }
235 }
236 }
237
238 return java.util.Collections.unmodifiableList( anyElements );
239 }
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259 protected <T> javax.xml.bind.JAXBElement<T> getAnyElement( final java.util.List<Object> any,
260 final String namespaceURI,
261 final String localPart,
262 final Class<T> type )
263 {
264 if ( any == null )
265 {
266 throw new NullPointerException( "any" );
267 }
268 if ( namespaceURI == null )
269 {
270 throw new NullPointerException( "namespaceURI" );
271 }
272 if ( localPart == null )
273 {
274 throw new NullPointerException( "localPart" );
275 }
276 if ( type == null )
277 {
278 throw new NullPointerException( "type" );
279 }
280
281 javax.xml.bind.JAXBElement<?> anyElement = null;
282
283 for ( int i = 0, s0 = any.size(); i < s0; i++ )
284 {
285 final Object o = any.get( i );
286
287 if ( o instanceof javax.xml.bind.JAXBElement<?> )
288 {
289 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
290
291 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
292 && localPart.equals( e.getName().getLocalPart() ) )
293 {
294 if ( anyElement == null )
295 {
296 anyElement = e;
297 }
298 else
299 {
300 throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(),
301 namespaceURI, localPart ) );
302
303 }
304 }
305 }
306 }
307
308 if ( anyElement != null && anyElement.getValue() != null && anyElement.getValue().getClass().equals( type ) )
309 {
310 @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> e =
311 (javax.xml.bind.JAXBElement<T>) anyElement;
312
313 return e;
314 }
315
316 return null;
317 }
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337 protected <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final java.util.List<Object> any,
338 final String namespaceURI,
339 final String localPart,
340 final Class<T> type )
341 {
342 if ( any == null )
343 {
344 throw new NullPointerException( "any" );
345 }
346 if ( namespaceURI == null )
347 {
348 throw new NullPointerException( "namespaceURI" );
349 }
350 if ( localPart == null )
351 {
352 throw new NullPointerException( "localPart" );
353 }
354 if ( type == null )
355 {
356 throw new NullPointerException( "type" );
357 }
358
359 final java.util.List<javax.xml.bind.JAXBElement<T>> anyElements =
360 new java.util.ArrayList<javax.xml.bind.JAXBElement<T>>( any.size() );
361
362 for ( int i = 0, s0 = any.size(); i < s0; i++ )
363 {
364 final Object o = any.get( i );
365
366 if ( o instanceof javax.xml.bind.JAXBElement<?> )
367 {
368 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
369
370 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
371 && localPart.equals( e.getName().getLocalPart() )
372 && e.getValue() != null && e.getValue().getClass().equals( type ) )
373 {
374 @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> anyElement =
375 (javax.xml.bind.JAXBElement<T>) e;
376
377 anyElements.add( anyElement );
378 }
379 }
380 }
381
382 return java.util.Collections.unmodifiableList( anyElements );
383 }
384
385
386
387
388
389
390
391
392
393
394
395
396
397 protected <T> T getAnyObject( final java.util.List<Object> any, final Class<T> clazz )
398 {
399 if ( any == null )
400 {
401 throw new NullPointerException( "any" );
402 }
403 if ( clazz == null )
404 {
405 throw new NullPointerException( "clazz" );
406 }
407
408 T anyObject = null;
409
410 for ( int i = 0, s0 = any.size(); i < s0; i++ )
411 {
412 Object o = any.get( i );
413
414 if ( o instanceof javax.xml.bind.JAXBElement<?> )
415 {
416 o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue();
417 }
418
419 if ( clazz.equals( o.getClass() ) )
420 {
421 if ( anyObject == null )
422 {
423 @SuppressWarnings( "unchecked" ) final T object = (T) o;
424 anyObject = object;
425 }
426 else
427 {
428 throw new IllegalStateException( getMessage( "nonUniqueObject", this.getClass().getName(),
429 clazz.getName() ) );
430
431 }
432 }
433 }
434
435 return anyObject;
436 }
437
438
439
440
441
442
443
444
445
446
447
448
449
450 protected <T> java.util.List<T> getAnyObjects( final java.util.List<Object> any, final Class<T> clazz )
451 {
452 if ( any == null )
453 {
454 throw new NullPointerException( "any" );
455 }
456 if ( clazz == null )
457 {
458 throw new NullPointerException( "namespaceURI" );
459 }
460
461 final java.util.List<T> anyElements = new java.util.ArrayList<T>( any.size() );
462
463 for ( int i = 0, s0 = any.size(); i < s0; i++ )
464 {
465 Object o = any.get( i );
466
467 if ( o instanceof javax.xml.bind.JAXBElement<?> )
468 {
469 o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue();
470 }
471
472 if ( clazz.equals( o.getClass() ) )
473 {
474 @SuppressWarnings( "unchecked" ) final T object = (T) o;
475 anyElements.add( object );
476 }
477 }
478
479 return java.util.Collections.unmodifiableList( anyElements );
480 }
481
482 private static String getMessage( final String key, final Object... args )
483 {
484 return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle(
485 ModletObject.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ).
486 getString( key ), args );
487
488 }
489
490 }