1
2
3
4
5
6
7
8
9 package org.jomc.model;
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.XmlAttribute;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlSeeAlso;
17 import javax.xml.bind.annotation.XmlType;
18 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
19 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
20 import javax.xml.datatype.XMLGregorianCalendar;
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 @XmlAccessorType(XmlAccessType.FIELD)
49 @XmlType(name = "ModelObject", namespace = "http://jomc.org/model", propOrder = {
50 "documentation",
51 "authors"
52 })
53 @XmlSeeAlso({
54 Argument.class,
55 Module.class,
56 Implementations.class,
57 Property.class,
58 Properties.class,
59 Instances.class,
60 Persons.class,
61 Messages.class,
62 Specifications.class,
63 Message.class,
64 Person.class,
65 Authors.class,
66 Arguments.class,
67 Dependencies.class,
68 Implementation.class,
69 Specification.class,
70 Instance.class,
71 Modules.class,
72 ImplementationReference.class,
73 SpecificationReference.class,
74 MessageReference.class,
75 PropertyReference.class
76 })
77 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
78 public class ModelObject implements Cloneable
79 {
80
81 @XmlElement(namespace = "http://jomc.org/model")
82 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
83 protected Texts documentation;
84 @XmlElement(namespace = "http://jomc.org/model")
85 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
86 protected Authors authors;
87 @XmlAttribute(name = "modelVersion")
88 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
89 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
90 protected String modelVersion;
91 @XmlAttribute(name = "createDate")
92 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
93 protected XMLGregorianCalendar createDate;
94 @XmlAttribute(name = "deprecated")
95 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
96 protected Boolean deprecated;
97
98
99
100
101
102 public ModelObject() {
103
104 super();
105 }
106
107
108
109
110
111
112
113
114
115
116 public ModelObject(final ModelObject o) {
117
118 super();
119 if (o == null) {
120 throw new NullPointerException("Cannot create a copy of 'ModelObject' from 'null'.");
121 }
122
123 this.documentation = ((o.documentation == null)?null:((o.getDocumentation() == null)?null:o.getDocumentation().clone()));
124
125 this.authors = ((o.authors == null)?null:((o.getAuthors() == null)?null:o.getAuthors().clone()));
126
127 this.modelVersion = ((o.modelVersion == null)?null:o.getModelVersion());
128
129 this.createDate = ((o.createDate == null)?null:((o.getCreateDate() == null)?null:((XMLGregorianCalendar) o.getCreateDate().clone())));
130
131 this.deprecated = ((o.deprecated == null)?null:o.isDeprecated());
132 }
133
134
135
136
137
138
139
140
141
142 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
143 public Texts getDocumentation() {
144 return documentation;
145 }
146
147
148
149
150
151
152
153
154
155 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
156 public void setDocumentation(Texts value) {
157 this.documentation = value;
158 }
159
160
161
162
163
164
165
166
167
168 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
169 public Authors getAuthors() {
170 return authors;
171 }
172
173
174
175
176
177
178
179
180
181 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
182 public void setAuthors(Authors value) {
183 this.authors = value;
184 }
185
186
187
188
189
190
191
192
193
194 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
195 public String getModelVersion() {
196 if (modelVersion == null) {
197 return "1.2";
198 } else {
199 return modelVersion;
200 }
201 }
202
203
204
205
206
207
208
209
210
211 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
212 public void setModelVersion(String value) {
213 this.modelVersion = value;
214 }
215
216
217
218
219
220
221
222
223
224 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
225 public XMLGregorianCalendar getCreateDate() {
226 return createDate;
227 }
228
229
230
231
232
233
234
235
236
237 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
238 public void setCreateDate(XMLGregorianCalendar value) {
239 this.createDate = value;
240 }
241
242
243
244
245
246
247
248
249
250 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
251 public boolean isDeprecated() {
252 if (deprecated == null) {
253 return false;
254 } else {
255 return deprecated;
256 }
257 }
258
259
260
261
262
263
264
265
266
267 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
268 public void setDeprecated(Boolean value) {
269 this.deprecated = value;
270 }
271
272
273
274
275
276
277
278
279 @Override
280 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-21T08:43:16+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
281 public ModelObject clone() {
282 try {
283 {
284
285 final ModelObject clone = ((ModelObject) super.clone());
286
287 clone.documentation = ((this.documentation == null)?null:((this.getDocumentation() == null)?null:this.getDocumentation().clone()));
288
289 clone.authors = ((this.authors == null)?null:((this.getAuthors() == null)?null:this.getAuthors().clone()));
290
291 clone.modelVersion = ((this.modelVersion == null)?null:this.getModelVersion());
292
293 clone.createDate = ((this.createDate == null)?null:((this.getCreateDate() == null)?null:((XMLGregorianCalendar) this.getCreateDate().clone())));
294
295 clone.deprecated = ((this.deprecated == null)?null:this.isDeprecated());
296 return clone;
297 }
298 } catch (CloneNotSupportedException e) {
299
300 throw new AssertionError(e);
301 }
302 }
303
304
305 public static final String MODEL_PUBLIC_ID = "http://jomc.org/model";
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323 @Deprecated
324 protected javax.xml.bind.JAXBElement getAnyElement( final java.util.List<Object> any, final String namespaceURI,
325 final String localPart )
326 {
327 if ( any == null )
328 {
329 throw new NullPointerException( "any" );
330 }
331 if ( namespaceURI == null )
332 {
333 throw new NullPointerException( "namespaceURI" );
334 }
335 if ( localPart == null )
336 {
337 throw new NullPointerException( "localPart" );
338 }
339
340 javax.xml.bind.JAXBElement<?> anyElement = null;
341
342 for ( int i = 0, s0 = any.size(); i < s0; i++ )
343 {
344 final Object o = any.get( i );
345
346 if ( o instanceof javax.xml.bind.JAXBElement<?> )
347 {
348 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
349
350 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
351 && localPart.equals( e.getName().getLocalPart() ) )
352 {
353 if ( anyElement == null )
354 {
355 anyElement = e;
356 }
357 else
358 {
359 throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(),
360 namespaceURI, localPart ) );
361
362 }
363 }
364 }
365 }
366
367 return anyElement;
368 }
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386 @Deprecated
387 protected java.util.List<javax.xml.bind.JAXBElement> getAnyElements( final java.util.List<Object> any,
388 final String namespaceURI,
389 final String localPart )
390 {
391 if ( any == null )
392 {
393 throw new NullPointerException( "any" );
394 }
395 if ( namespaceURI == null )
396 {
397 throw new NullPointerException( "namespaceURI" );
398 }
399 if ( localPart == null )
400 {
401 throw new NullPointerException( "localPart" );
402 }
403
404 final java.util.List<javax.xml.bind.JAXBElement> anyElements =
405 new java.util.ArrayList<javax.xml.bind.JAXBElement>( any.size() );
406
407 for ( int i = 0, s0 = any.size(); i < s0; i++ )
408 {
409 final Object o = any.get( i );
410
411 if ( o instanceof javax.xml.bind.JAXBElement<?> )
412 {
413 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
414
415 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
416 && localPart.equals( e.getName().getLocalPart() ) )
417 {
418 anyElements.add( e );
419 }
420 }
421 }
422
423 return java.util.Collections.unmodifiableList( anyElements );
424 }
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444 protected <T> javax.xml.bind.JAXBElement<T> getAnyElement( final java.util.List<Object> any,
445 final String namespaceURI,
446 final String localPart,
447 final Class<T> type )
448 {
449 if ( any == null )
450 {
451 throw new NullPointerException( "any" );
452 }
453 if ( namespaceURI == null )
454 {
455 throw new NullPointerException( "namespaceURI" );
456 }
457 if ( localPart == null )
458 {
459 throw new NullPointerException( "localPart" );
460 }
461 if ( type == null )
462 {
463 throw new NullPointerException( "type" );
464 }
465
466 javax.xml.bind.JAXBElement<?> anyElement = null;
467
468 for ( int i = 0, s0 = any.size(); i < s0; i++ )
469 {
470 final Object o = any.get( i );
471
472 if ( o instanceof javax.xml.bind.JAXBElement<?> )
473 {
474 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
475
476 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
477 && localPart.equals( e.getName().getLocalPart() ) )
478 {
479 if ( anyElement == null )
480 {
481 anyElement = e;
482 }
483 else
484 {
485 throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(),
486 namespaceURI, localPart ) );
487
488 }
489 }
490 }
491 }
492
493 if ( anyElement != null && anyElement.getValue() != null && anyElement.getValue().getClass().equals( type ) )
494 {
495 @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> e =
496 (javax.xml.bind.JAXBElement<T>) anyElement;
497
498 return e;
499 }
500
501 return null;
502 }
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522 protected <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final java.util.List<Object> any,
523 final String namespaceURI,
524 final String localPart,
525 final Class<T> type )
526 {
527 if ( any == null )
528 {
529 throw new NullPointerException( "any" );
530 }
531 if ( namespaceURI == null )
532 {
533 throw new NullPointerException( "namespaceURI" );
534 }
535 if ( localPart == null )
536 {
537 throw new NullPointerException( "localPart" );
538 }
539 if ( type == null )
540 {
541 throw new NullPointerException( "type" );
542 }
543
544 final java.util.List<javax.xml.bind.JAXBElement<T>> anyElements =
545 new java.util.ArrayList<javax.xml.bind.JAXBElement<T>>( any.size() );
546
547 for ( int i = 0, s0 = any.size(); i < s0; i++ )
548 {
549 final Object o = any.get( i );
550
551 if ( o instanceof javax.xml.bind.JAXBElement<?> )
552 {
553 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
554
555 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
556 && localPart.equals( e.getName().getLocalPart() )
557 && e.getValue() != null && e.getValue().getClass().equals( type ) )
558 {
559 @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> anyElement =
560 (javax.xml.bind.JAXBElement<T>) e;
561
562 anyElements.add( anyElement );
563 }
564 }
565 }
566
567 return java.util.Collections.unmodifiableList( anyElements );
568 }
569
570
571
572
573
574
575
576
577
578
579
580
581
582 protected <T> T getAnyObject( final java.util.List<Object> any, final Class<T> clazz )
583 {
584 if ( any == null )
585 {
586 throw new NullPointerException( "any" );
587 }
588 if ( clazz == null )
589 {
590 throw new NullPointerException( "clazz" );
591 }
592
593 T anyObject = null;
594
595 for ( int i = 0, s0 = any.size(); i < s0; i++ )
596 {
597 Object o = any.get( i );
598
599 if ( o instanceof javax.xml.bind.JAXBElement<?> )
600 {
601 o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue();
602 }
603
604 if ( clazz.equals( o.getClass() ) )
605 {
606 if ( anyObject == null )
607 {
608 @SuppressWarnings( "unchecked" ) final T object = (T) o;
609 anyObject = object;
610 }
611 else
612 {
613 throw new IllegalStateException( getMessage( "nonUniqueObject", this.getClass().getName(),
614 clazz.getName() ) );
615
616 }
617 }
618 }
619
620 return anyObject;
621 }
622
623
624
625
626
627
628
629
630
631
632
633
634
635 protected <T> java.util.List<T> getAnyObjects( final java.util.List<Object> any, final Class<T> clazz )
636 {
637 if ( any == null )
638 {
639 throw new NullPointerException( "any" );
640 }
641 if ( clazz == null )
642 {
643 throw new NullPointerException( "namespaceURI" );
644 }
645
646 final java.util.List<T> anyElements = new java.util.ArrayList<T>( any.size() );
647
648 for ( int i = 0, s0 = any.size(); i < s0; i++ )
649 {
650 Object o = any.get( i );
651
652 if ( o instanceof javax.xml.bind.JAXBElement<?> )
653 {
654 o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue();
655 }
656
657 if ( clazz.equals( o.getClass() ) )
658 {
659 @SuppressWarnings( "unchecked" ) final T object = (T) o;
660 anyElements.add( object );
661 }
662 }
663
664 return java.util.Collections.unmodifiableList( anyElements );
665 }
666
667 private static String getMessage( final String key, final Object... args )
668 {
669 return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle(
670 ModelObject.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ).
671 getString( key ), args );
672
673 }
674
675 }