001 //
002 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
003 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
004 // Any modifications to this file will be lost upon recompilation of the source schema.
005 // Generated on: 2012.04.26 at 04:53:34 AM CEST
006 //
007
008
009 package org.jomc.model;
010
011 import java.io.ByteArrayInputStream;
012 import java.io.ByteArrayOutputStream;
013 import java.io.File;
014 import java.io.IOException;
015 import java.io.InvalidClassException;
016 import java.io.NotSerializableException;
017 import java.io.ObjectInputStream;
018 import java.io.ObjectOutputStream;
019 import java.io.OptionalDataException;
020 import java.io.Serializable;
021 import java.io.StreamCorruptedException;
022 import java.lang.reflect.Array;
023 import java.lang.reflect.InvocationTargetException;
024 import java.math.BigDecimal;
025 import java.math.BigInteger;
026 import java.net.MalformedURLException;
027 import java.net.URI;
028 import java.net.URISyntaxException;
029 import java.net.URL;
030 import java.util.ArrayList;
031 import java.util.Calendar;
032 import java.util.Currency;
033 import java.util.Date;
034 import java.util.Iterator;
035 import java.util.List;
036 import java.util.Locale;
037 import java.util.TimeZone;
038 import java.util.UUID;
039 import javax.activation.MimeType;
040 import javax.activation.MimeTypeParseException;
041 import javax.annotation.Generated;
042 import javax.xml.bind.JAXBElement;
043 import javax.xml.bind.annotation.XmlAccessType;
044 import javax.xml.bind.annotation.XmlAccessorType;
045 import javax.xml.bind.annotation.XmlAnyElement;
046 import javax.xml.bind.annotation.XmlAttribute;
047 import javax.xml.bind.annotation.XmlElement;
048 import javax.xml.bind.annotation.XmlType;
049 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
050 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
051 import javax.xml.datatype.Duration;
052 import javax.xml.datatype.XMLGregorianCalendar;
053 import javax.xml.namespace.QName;
054 import org.w3c.dom.Element;
055
056
057 /**
058 *
059 * Model of an instance.
060 *
061 * The 'Instance' type defines attributes 'identifier', 'name', 'class' and 'stateless'. Attribute 'identifier' holds an
062 * identifier uniquely identifying the instance in a set of instances. Attribute 'name' holds an identifier uniquely
063 * identifying the implementation of the specifications implemented by an instance. Attribute 'class' holds an identifier
064 * of the class of an instance. Attribute 'stateless' flags an instance stateless.
065 *
066 * An instance is build from implementations. An implementation declaring a location declares its instance located outside
067 * the scope of the model. An implementation not delcaring a class is only available during implementation inheritance
068 * processing. No instance is build from such implementations.
069 *
070 *
071 * <p>Java class for Instance complex type.
072 *
073 * <p>The following schema fragment specifies the expected content contained within this class.
074 *
075 * <pre>
076 * <complexType name="Instance">
077 * <complexContent>
078 * <extension base="{http://jomc.org/model}ModelObject">
079 * <sequence>
080 * <element ref="{http://jomc.org/model}specifications" minOccurs="0"/>
081 * <element ref="{http://jomc.org/model}dependencies" minOccurs="0"/>
082 * <element ref="{http://jomc.org/model}properties" minOccurs="0"/>
083 * <element ref="{http://jomc.org/model}messages" minOccurs="0"/>
084 * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
085 * </sequence>
086 * <attribute name="identifier" use="required" type="{http://jomc.org/model}Identifier" />
087 * <attribute name="name" use="required" type="{http://jomc.org/model}Identifier" />
088 * <attribute name="class" use="required" type="{http://jomc.org/model}Identifier" />
089 * <attribute name="stateless" type="{http://jomc.org/model}Flag" default="false" />
090 * </extension>
091 * </complexContent>
092 * </complexType>
093 * </pre>
094 *
095 *
096 */
097 @XmlAccessorType(XmlAccessType.FIELD)
098 @XmlType(name = "Instance", namespace = "http://jomc.org/model", propOrder = {
099 "specifications",
100 "dependencies",
101 "properties",
102 "messages",
103 "any"
104 })
105 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
106 public class Instance
107 extends ModelObject
108 implements Cloneable
109 {
110
111 @XmlElement(namespace = "http://jomc.org/model")
112 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
113 protected Specifications specifications;
114 @XmlElement(namespace = "http://jomc.org/model")
115 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
116 protected Dependencies dependencies;
117 @XmlElement(namespace = "http://jomc.org/model")
118 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
119 protected Properties properties;
120 @XmlElement(namespace = "http://jomc.org/model")
121 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
122 protected Messages messages;
123 @XmlAnyElement(lax = true)
124 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
125 protected List<Object> any;
126 @XmlAttribute(name = "identifier", required = true)
127 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
128 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
129 protected String identifier;
130 @XmlAttribute(name = "name", required = true)
131 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
132 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
133 protected String name;
134 @XmlAttribute(name = "class", required = true)
135 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
136 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
137 protected String clazz;
138 @XmlAttribute(name = "stateless")
139 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
140 protected Boolean stateless;
141
142 /**
143 * Creates a new {@code Instance} instance.
144 *
145 */
146 public Instance() {
147 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
148 super();
149 }
150
151 /**
152 * Creates a new {@code Instance} instance by deeply copying a given {@code Instance} instance.
153 *
154 *
155 * @param o
156 * The instance to copy.
157 * @throws NullPointerException
158 * if {@code o} is {@code null}.
159 */
160 public Instance(final Instance o) {
161 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
162 super(o);
163 if (o == null) {
164 throw new NullPointerException("Cannot create a copy of 'Instance' from 'null'.");
165 }
166 // CClassInfo: org.jomc.model.Specifications
167 this.specifications = ((o.specifications == null)?null:((o.getSpecifications() == null)?null:o.getSpecifications().clone()));
168 // CClassInfo: org.jomc.model.Dependencies
169 this.dependencies = ((o.dependencies == null)?null:((o.getDependencies() == null)?null:o.getDependencies().clone()));
170 // CClassInfo: org.jomc.model.Properties
171 this.properties = ((o.properties == null)?null:((o.getProperties() == null)?null:o.getProperties().clone()));
172 // CClassInfo: org.jomc.model.Messages
173 this.messages = ((o.messages == null)?null:((o.getMessages() == null)?null:o.getMessages().clone()));
174 // 'Any' collection.
175 if (o.any!= null) {
176 copyAny(o.getAny(), this.getAny());
177 }
178 // CBuiltinLeafInfo: java.lang.String
179 this.identifier = ((o.identifier == null)?null:o.getIdentifier());
180 // CBuiltinLeafInfo: java.lang.String
181 this.name = ((o.name == null)?null:o.getName());
182 // CBuiltinLeafInfo: java.lang.String
183 this.clazz = ((o.clazz == null)?null:o.getClazz());
184 // CBuiltinLeafInfo: java.lang.Boolean
185 this.stateless = ((o.stateless == null)?null:o.isStateless());
186 }
187
188 /**
189 * Specifications implemented by this instance or {@code null}.
190 *
191 * @return
192 * possible object is
193 * {@link Specifications }
194 *
195 */
196 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
197 public Specifications getSpecifications() {
198 return specifications;
199 }
200
201 /**
202 * Sets the value of the specifications property.
203 *
204 * @param value
205 * allowed object is
206 * {@link Specifications }
207 *
208 */
209 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
210 public void setSpecifications(Specifications value) {
211 this.specifications = value;
212 }
213
214 /**
215 * Dependencies of this instance or {@code null}.
216 *
217 * @return
218 * possible object is
219 * {@link Dependencies }
220 *
221 */
222 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
223 public Dependencies getDependencies() {
224 return dependencies;
225 }
226
227 /**
228 * Sets the value of the dependencies property.
229 *
230 * @param value
231 * allowed object is
232 * {@link Dependencies }
233 *
234 */
235 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
236 public void setDependencies(Dependencies value) {
237 this.dependencies = value;
238 }
239
240 /**
241 * Properties of this instance or {@code null}.
242 *
243 * @return
244 * possible object is
245 * {@link Properties }
246 *
247 */
248 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
249 public Properties getProperties() {
250 return properties;
251 }
252
253 /**
254 * Sets the value of the properties property.
255 *
256 * @param value
257 * allowed object is
258 * {@link Properties }
259 *
260 */
261 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
262 public void setProperties(Properties value) {
263 this.properties = value;
264 }
265
266 /**
267 * Messages of this instance or {@code null}.
268 *
269 * @return
270 * possible object is
271 * {@link Messages }
272 *
273 */
274 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
275 public Messages getMessages() {
276 return messages;
277 }
278
279 /**
280 * Sets the value of the messages property.
281 *
282 * @param value
283 * allowed object is
284 * {@link Messages }
285 *
286 */
287 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
288 public void setMessages(Messages value) {
289 this.messages = value;
290 }
291
292 /**
293 * Gets the value of the any property.
294 *
295 * <p>
296 * This accessor method returns a reference to the live list,
297 * not a snapshot. Therefore any modification you make to the
298 * returned list will be present inside the JAXB object.
299 * This is why there is not a <CODE>set</CODE> method for the any property.
300 *
301 * <p>
302 * For example, to add a new item, do as follows:
303 * <pre>
304 * getAny().add(newItem);
305 * </pre>
306 *
307 *
308 * <p>
309 * Objects of the following type(s) are allowed in the list
310 * {@link Object }
311 * {@link Element }
312 *
313 *
314 */
315 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
316 public List<Object> getAny() {
317 if (any == null) {
318 any = new ArrayList<Object>();
319 }
320 return this.any;
321 }
322
323 /**
324 * The identifier of this instance.
325 *
326 * @return
327 * possible object is
328 * {@link String }
329 *
330 */
331 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
332 public String getIdentifier() {
333 return identifier;
334 }
335
336 /**
337 * Sets the value of the identifier property.
338 *
339 * @param value
340 * allowed object is
341 * {@link String }
342 *
343 */
344 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
345 public void setIdentifier(String value) {
346 this.identifier = value;
347 }
348
349 /**
350 * The name of the implementation of the specifications implemented by this instance.
351 *
352 * @return
353 * possible object is
354 * {@link String }
355 *
356 */
357 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
358 public String getName() {
359 return name;
360 }
361
362 /**
363 * Sets the value of the name property.
364 *
365 * @param value
366 * allowed object is
367 * {@link String }
368 *
369 */
370 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
371 public void setName(String value) {
372 this.name = value;
373 }
374
375 /**
376 * The identifier of the class of this instance.
377 *
378 * @return
379 * possible object is
380 * {@link String }
381 *
382 */
383 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
384 public String getClazz() {
385 return clazz;
386 }
387
388 /**
389 * Sets the value of the clazz property.
390 *
391 * @param value
392 * allowed object is
393 * {@link String }
394 *
395 */
396 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
397 public void setClazz(String value) {
398 this.clazz = value;
399 }
400
401 /**
402 * {@code true}, if this instance does not retain state across operations.
403 *
404 * @return
405 * possible object is
406 * {@link Boolean }
407 *
408 */
409 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
410 public boolean isStateless() {
411 if (stateless == null) {
412 return false;
413 } else {
414 return stateless;
415 }
416 }
417
418 /**
419 * Sets the value of the stateless property.
420 *
421 * @param value
422 * allowed object is
423 * {@link Boolean }
424 *
425 */
426 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
427 public void setStateless(Boolean value) {
428 this.stateless = value;
429 }
430
431 /**
432 * Copies all values of property {@code Any} deeply.
433 *
434 * @param source
435 * The source to copy from.
436 * @param target
437 * The target to copy {@code source} to.
438 * @throws NullPointerException
439 * if {@code target} is {@code null}.
440 */
441 @SuppressWarnings("unchecked")
442 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
443 private static void copyAny(final List<Object> source, final List<Object> target) {
444 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
445 if ((source!= null)&&(!source.isEmpty())) {
446 for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
447 final Object next = it.next();
448 if (next instanceof Element) {
449 // CWildcardTypeInfo: org.w3c.dom.Element
450 target.add(((Element)((Element) next).cloneNode(true)));
451 continue;
452 }
453 if (next instanceof Object) {
454 // CBuiltinLeafInfo: java.lang.Object
455 target.add(copyOf(((Object) next)));
456 continue;
457 }
458 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
459 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.model.Instance'."));
460 }
461 }
462 }
463
464 /**
465 * Creates and returns a deep copy of a given object.
466 *
467 * @param o
468 * The instance to copy or {@code null}.
469 * @return
470 * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}.
471 */
472 @SuppressWarnings("unchecked")
473 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
474 private static Object copyOf(final Object o) {
475 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
476 try {
477 if (o!= null) {
478 if (o.getClass().isPrimitive()) {
479 return o;
480 }
481 if (o.getClass().isArray()) {
482 return copyOfArray(o);
483 }
484 // Immutable types.
485 if (o instanceof Boolean) {
486 return o;
487 }
488 if (o instanceof Byte) {
489 return o;
490 }
491 if (o instanceof Character) {
492 return o;
493 }
494 if (o instanceof Double) {
495 return o;
496 }
497 if (o instanceof Enum) {
498 return o;
499 }
500 if (o instanceof Float) {
501 return o;
502 }
503 if (o instanceof Integer) {
504 return o;
505 }
506 if (o instanceof Long) {
507 return o;
508 }
509 if (o instanceof Short) {
510 return o;
511 }
512 if (o instanceof String) {
513 return o;
514 }
515 if (o instanceof BigDecimal) {
516 return o;
517 }
518 if (o instanceof BigInteger) {
519 return o;
520 }
521 if (o instanceof UUID) {
522 return o;
523 }
524 if (o instanceof QName) {
525 return o;
526 }
527 if (o instanceof Duration) {
528 return o;
529 }
530 if (o instanceof Currency) {
531 return o;
532 }
533 // String based types.
534 if (o instanceof File) {
535 return new File(o.toString());
536 }
537 if (o instanceof URI) {
538 return new URI(o.toString());
539 }
540 if (o instanceof URL) {
541 return new URL(o.toString());
542 }
543 if (o instanceof MimeType) {
544 return new MimeType(o.toString());
545 }
546 // Cloneable types.
547 if (o instanceof XMLGregorianCalendar) {
548 return ((XMLGregorianCalendar) o).clone();
549 }
550 if (o instanceof Date) {
551 return ((Date) o).clone();
552 }
553 if (o instanceof Calendar) {
554 return ((Calendar) o).clone();
555 }
556 if (o instanceof TimeZone) {
557 return ((TimeZone) o).clone();
558 }
559 if (o instanceof Locale) {
560 return ((Locale) o).clone();
561 }
562 if (o instanceof Element) {
563 return ((Element)((Element) o).cloneNode(true));
564 }
565 if (o instanceof JAXBElement) {
566 return copyOf(((JAXBElement) o));
567 }
568 try {
569 return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null));
570 } catch (NoSuchMethodException e) {
571 if (o instanceof Serializable) {
572 return copyOf(((Serializable) o));
573 }
574 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
575 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
576 } catch (IllegalAccessException e) {
577 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
578 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
579 } catch (InvocationTargetException e) {
580 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
581 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
582 } catch (SecurityException e) {
583 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
584 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
585 } catch (IllegalArgumentException e) {
586 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
587 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
588 } catch (ExceptionInInitializerError e) {
589 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
590 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
591 }
592 }
593 return null;
594 } catch (MalformedURLException e) {
595 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
596 } catch (URISyntaxException e) {
597 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
598 } catch (MimeTypeParseException e) {
599 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
600 }
601 }
602
603 /**
604 * Creates and returns a deep copy of a given array.
605 *
606 * @param array
607 * The array to copy or {@code null}.
608 * @return
609 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
610 */
611 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
612 private static Object copyOfArray(final Object array) {
613 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
614 if (array!= null) {
615 if (array.getClass() == boolean[].class) {
616 return copyOf(((boolean[]) array));
617 }
618 if (array.getClass() == byte[].class) {
619 return copyOf(((byte[]) array));
620 }
621 if (array.getClass() == char[].class) {
622 return copyOf(((char[]) array));
623 }
624 if (array.getClass() == double[].class) {
625 return copyOf(((double[]) array));
626 }
627 if (array.getClass() == float[].class) {
628 return copyOf(((float[]) array));
629 }
630 if (array.getClass() == int[].class) {
631 return copyOf(((int[]) array));
632 }
633 if (array.getClass() == long[].class) {
634 return copyOf(((long[]) array));
635 }
636 if (array.getClass() == short[].class) {
637 return copyOf(((short[]) array));
638 }
639 final int len = Array.getLength(array);
640 final Object copy = Array.newInstance(array.getClass().getComponentType(), len);
641 for (int i = (len- 1); (i >= 0); i--) {
642 Array.set(copy, i, copyOf(Array.get(array, i)));
643 }
644 return copy;
645 }
646 return null;
647 }
648
649 /**
650 * Creates and returns a deep copy of a given array.
651 *
652 * @param array
653 * The array to copy or {@code null}.
654 * @return
655 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
656 */
657 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
658 private static boolean[] copyOf(final boolean[] array) {
659 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
660 if (array!= null) {
661 final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length));
662 System.arraycopy(array, 0, copy, 0, array.length);
663 return copy;
664 }
665 return null;
666 }
667
668 /**
669 * Creates and returns a deep copy of a given array.
670 *
671 * @param array
672 * The array to copy or {@code null}.
673 * @return
674 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
675 */
676 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
677 private static byte[] copyOf(final byte[] array) {
678 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
679 if (array!= null) {
680 final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length));
681 System.arraycopy(array, 0, copy, 0, array.length);
682 return copy;
683 }
684 return null;
685 }
686
687 /**
688 * Creates and returns a deep copy of a given array.
689 *
690 * @param array
691 * The array to copy or {@code null}.
692 * @return
693 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
694 */
695 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
696 private static char[] copyOf(final char[] array) {
697 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
698 if (array!= null) {
699 final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length));
700 System.arraycopy(array, 0, copy, 0, array.length);
701 return copy;
702 }
703 return null;
704 }
705
706 /**
707 * Creates and returns a deep copy of a given array.
708 *
709 * @param array
710 * The array to copy or {@code null}.
711 * @return
712 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
713 */
714 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
715 private static double[] copyOf(final double[] array) {
716 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
717 if (array!= null) {
718 final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length));
719 System.arraycopy(array, 0, copy, 0, array.length);
720 return copy;
721 }
722 return null;
723 }
724
725 /**
726 * Creates and returns a deep copy of a given array.
727 *
728 * @param array
729 * The array to copy or {@code null}.
730 * @return
731 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
732 */
733 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
734 private static float[] copyOf(final float[] array) {
735 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
736 if (array!= null) {
737 final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length));
738 System.arraycopy(array, 0, copy, 0, array.length);
739 return copy;
740 }
741 return null;
742 }
743
744 /**
745 * Creates and returns a deep copy of a given array.
746 *
747 * @param array
748 * The array to copy or {@code null}.
749 * @return
750 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
751 */
752 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
753 private static int[] copyOf(final int[] array) {
754 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
755 if (array!= null) {
756 final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length));
757 System.arraycopy(array, 0, copy, 0, array.length);
758 return copy;
759 }
760 return null;
761 }
762
763 /**
764 * Creates and returns a deep copy of a given array.
765 *
766 * @param array
767 * The array to copy or {@code null}.
768 * @return
769 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
770 */
771 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
772 private static long[] copyOf(final long[] array) {
773 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
774 if (array!= null) {
775 final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length));
776 System.arraycopy(array, 0, copy, 0, array.length);
777 return copy;
778 }
779 return null;
780 }
781
782 /**
783 * Creates and returns a deep copy of a given array.
784 *
785 * @param array
786 * The array to copy or {@code null}.
787 * @return
788 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
789 */
790 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
791 private static short[] copyOf(final short[] array) {
792 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
793 if (array!= null) {
794 final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length));
795 System.arraycopy(array, 0, copy, 0, array.length);
796 return copy;
797 }
798 return null;
799 }
800
801 /**
802 * Creates and returns a deep copy of a given {@code JAXBElement} instance.
803 *
804 * @param element
805 * The instance to copy or {@code null}.
806 * @return
807 * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}.
808 */
809 @SuppressWarnings("unchecked")
810 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
811 private static JAXBElement copyOf(final JAXBElement element) {
812 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
813 if (element!= null) {
814 final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue());
815 copy.setNil(element.isNil());
816 copy.setValue(copyOf(copy.getValue()));
817 return copy;
818 }
819 return null;
820 }
821
822 /**
823 * Creates and returns a deep copy of a given {@code Serializable}.
824 *
825 * @param serializable
826 * The instance to copy or {@code null}.
827 * @return
828 * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}.
829 */
830 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
831 private static Serializable copyOf(final Serializable serializable) {
832 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
833 if (serializable!= null) {
834 try {
835 final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
836 final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput);
837 out.writeObject(serializable);
838 out.close();
839 final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray());
840 final ObjectInputStream in = new ObjectInputStream(byteArrayInput);
841 final Serializable copy = ((Serializable) in.readObject());
842 in.close();
843 return copy;
844 } catch (SecurityException e) {
845 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
846 } catch (ClassNotFoundException e) {
847 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
848 } catch (InvalidClassException e) {
849 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
850 } catch (NotSerializableException e) {
851 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
852 } catch (StreamCorruptedException e) {
853 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
854 } catch (OptionalDataException e) {
855 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
856 } catch (IOException e) {
857 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
858 }
859 }
860 return null;
861 }
862
863 /**
864 * Creates and returns a deep copy of this object.
865 *
866 *
867 * @return
868 * A deep copy of this object.
869 */
870 @Override
871 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-26T04:53:34+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
872 public Instance clone() {
873 {
874 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
875 final Instance clone = ((Instance) super.clone());
876 // CClassInfo: org.jomc.model.Specifications
877 clone.specifications = ((this.specifications == null)?null:((this.getSpecifications() == null)?null:this.getSpecifications().clone()));
878 // CClassInfo: org.jomc.model.Dependencies
879 clone.dependencies = ((this.dependencies == null)?null:((this.getDependencies() == null)?null:this.getDependencies().clone()));
880 // CClassInfo: org.jomc.model.Properties
881 clone.properties = ((this.properties == null)?null:((this.getProperties() == null)?null:this.getProperties().clone()));
882 // CClassInfo: org.jomc.model.Messages
883 clone.messages = ((this.messages == null)?null:((this.getMessages() == null)?null:this.getMessages().clone()));
884 // 'Any' collection.
885 if (this.any!= null) {
886 clone.any = null;
887 copyAny(this.getAny(), clone.getAny());
888 }
889 // CBuiltinLeafInfo: java.lang.String
890 clone.identifier = ((this.identifier == null)?null:this.getIdentifier());
891 // CBuiltinLeafInfo: java.lang.String
892 clone.name = ((this.name == null)?null:this.getName());
893 // CBuiltinLeafInfo: java.lang.String
894 clone.clazz = ((this.clazz == null)?null:this.getClazz());
895 // CBuiltinLeafInfo: java.lang.Boolean
896 clone.stateless = ((this.stateless == null)?null:this.isStateless());
897 return clone;
898 }
899 }
900
901 /**
902 * Empty {@code Class} array.
903 * @since 1.2
904 */
905 @javax.xml.bind.annotation.XmlTransient
906 private static final Class<?>[] NO_CLASSES =
907 {
908 };
909
910 /** Maps dependency names to dependency objects. */
911 @javax.xml.bind.annotation.XmlTransient private java.util.Map<String, Object> dependencyObjects;
912
913 /**
914 * Maps message names and locales to message format objects.
915 * @since 1.2
916 */
917 @javax.xml.bind.annotation.XmlTransient private java.util.Map<String, java.util.Map<java.util.Locale, java.text.MessageFormat>> messageObjects;
918
919 /** Maps property names to property objects. */
920 @javax.xml.bind.annotation.XmlTransient private java.util.Map<String, Object> propertyObjects;
921
922 /**
923 * Gets a mapping of dependency names to objects bound to the instance.
924 * <p>This method returns a reference to the live map, not a snapshot. Any modification you make to the returned map
925 * will be present inside the object.</p>
926 *
927 * @return A mapping of dependency names to objects bound to the instance.
928 */
929 public java.util.Map<String, Object> getDependencyObjects()
930 {
931 if ( this.dependencyObjects == null )
932 {
933 this.dependencyObjects = new java.util.HashMap<String, Object>();
934 }
935
936 return this.dependencyObjects;
937 }
938
939 /**
940 * Gets a mapping of message names to a mapping of locales to message format objects bound to the instance.
941 * <p>This method returns a reference to the live map, not a snapshot. Any modification you make to the returned map
942 * will be present inside the object.</p>
943 *
944 * @return A mapping of message names to a mapping of locales to message format objects bound to the instance.
945 *
946 * @since 1.2
947 */
948 public java.util.Map<String, java.util.Map<java.util.Locale, java.text.MessageFormat>> getMessageObjects()
949 {
950 if ( this.messageObjects == null )
951 {
952 this.messageObjects =
953 new java.util.HashMap<String, java.util.Map<java.util.Locale, java.text.MessageFormat>>();
954
955 }
956
957 return this.messageObjects;
958 }
959
960 /**
961 * Gets a mapping of property names to objects bound to the instance.
962 * <p>This method returns a reference to the live map, not a snapshot. Any modification you make to the returned map
963 * will be present inside the object.</p>
964 *
965 * @return A mapping of property names to objects bound to the instance.
966 */
967 public java.util.Map<String, Object> getPropertyObjects()
968 {
969 if ( this.propertyObjects == null )
970 {
971 this.propertyObjects = new java.util.HashMap<String, Object>();
972 }
973
974 return this.propertyObjects;
975 }
976
977 /**
978 * Gets the Java class of the instance for a given class loader.
979 *
980 * @param classLoader The class loader to get the Java class from or {@code null}, to get the Java class from the
981 * platform's bootstrap class loader.
982 *
983 * @return The Java class of the instance.
984 *
985 * @throws ClassNotFoundException if the Java class is not found.
986 *
987 * @see #getClazz()
988 *
989 * @since 1.2
990 */
991 public Class<?> getJavaClass( final ClassLoader classLoader ) throws ClassNotFoundException
992 {
993 return Class.forName( this.getClazz(), false, classLoader );
994 }
995
996 /**
997 * Gets the Java classes of all specifications of the instance for a given class loader.
998 *
999 * @param classLoader The class loader to get the Java classes from or {@code null}, to get the Java classes from
1000 * the platform's bootstrap class loader.
1001 *
1002 * @return The Java classes of all specifications of the instance.
1003 *
1004 * @throws ClassNotFoundException if a Java class is not found.
1005 *
1006 * @see #getSpecifications()
1007 * @see Specification#getClazz()
1008 *
1009 * @since 1.2
1010 */
1011 public Class<?>[] getJavaClasses( final ClassLoader classLoader ) throws ClassNotFoundException
1012 {
1013 final java.util.Set<Class<?>> classes = new java.util.HashSet<Class<?>>();
1014
1015 if ( this.getSpecifications() != null )
1016 {
1017 for ( int i = 0, s0 = this.getSpecifications().getSpecification().size(); i < s0; i++ )
1018 {
1019 final Specification s = this.getSpecifications().getSpecification().get( i );
1020 final Class<?> javaClass = s.getJavaClass( classLoader );
1021
1022 if ( javaClass != null )
1023 {
1024 classes.add( javaClass );
1025 }
1026 }
1027 }
1028
1029 return classes.toArray( new Class<?>[ classes.size() ] );
1030 }
1031
1032 /**
1033 * Gets the Java constructor to use for creating objects of the instance.
1034 *
1035 * @param classLoader The class loader to get the Java class from or {@code null}, to get the Java class from the
1036 * platform's bootstrap class loader.
1037 *
1038 * @return The public default Java constructor of the Java class of the instance or {@code null}, if that class
1039 * does not declare such a constructor, is abstract or is not public.
1040 *
1041 * @throws ClassNotFoundException if the Java class is not found.
1042 *
1043 * @see #getJavaClass(java.lang.ClassLoader)
1044 *
1045 * @since 1.2
1046 */
1047 public java.lang.reflect.Constructor<?> getJavaConstructor( final ClassLoader classLoader )
1048 throws ClassNotFoundException
1049 {
1050 java.lang.reflect.Constructor<?> javaConstructor = null;
1051 final Class<?> javaClass = this.getJavaClass( classLoader );
1052
1053 if ( java.lang.reflect.Modifier.isPublic( javaClass.getModifiers() )
1054 && !java.lang.reflect.Modifier.isAbstract( javaClass.getModifiers() ) )
1055 {
1056 try
1057 {
1058 javaConstructor = javaClass.getConstructor( NO_CLASSES );
1059 }
1060 catch ( final NoSuchMethodException e )
1061 {
1062 javaConstructor = null;
1063 }
1064 }
1065
1066 return javaConstructor;
1067 }
1068
1069 /**
1070 * Gets the name of the Java method to use for creating objects of the instance.
1071 *
1072 * @return The name of the Java method to use for creating objects of the instance or {@code null}, if no such
1073 * method name is supported.
1074 *
1075 * @see #getName()
1076 *
1077 * @since 1.2
1078 */
1079 public String getJavaFactoryMethodName()
1080 {
1081 String methodName = null;
1082
1083 char[] c = this.getName().toCharArray();
1084 c[0] = Character.toUpperCase( c[0] );
1085 methodName = "get" + String.valueOf( c );
1086
1087 boolean javaIdentifier = Character.isJavaIdentifierStart( c[0] );
1088 if ( javaIdentifier )
1089 {
1090 for ( int idx = c.length - 1; idx > 0; idx-- )
1091 {
1092 if ( !Character.isJavaIdentifierPart( c[idx] ) )
1093 {
1094 javaIdentifier = false;
1095 break;
1096 }
1097 }
1098 }
1099
1100 if ( !javaIdentifier )
1101 {
1102 methodName = null;
1103 }
1104
1105 return methodName;
1106 }
1107
1108 /**
1109 * Gets the Java method to use for creating objects of the instance.
1110 *
1111 * @param classLoader The class loader to get the Java class from or {@code null}, to get the Java class from the
1112 * platform's bootstrap class loader.
1113 *
1114 * @return The public Java method of the Java class of the instance to use for creating objects of the instance or
1115 * {@code null}, if that class does not declare such a method.
1116 *
1117 * @throws ClassNotFoundException if the Java class is not found.
1118 *
1119 * @see #getJavaClass(java.lang.ClassLoader)
1120 * @see #getJavaFactoryMethodName()
1121 *
1122 * @since 1.2
1123 */
1124 public java.lang.reflect.Method getJavaFactoryMethod( final ClassLoader classLoader )
1125 throws ClassNotFoundException
1126 {
1127 final Class<?> javaClass = this.getJavaClass( classLoader );
1128 java.lang.reflect.Method factoryMethod = null;
1129 String methodName = this.getJavaFactoryMethodName();
1130
1131 if ( methodName != null )
1132 {
1133 try
1134 {
1135 factoryMethod = javaClass.getMethod( methodName, (Class[]) null );
1136 }
1137 catch ( final NoSuchMethodException e )
1138 {
1139 factoryMethod = null;
1140 }
1141 }
1142
1143 if ( factoryMethod == null )
1144 {
1145 try
1146 {
1147 factoryMethod = javaClass.getMethod( "getObject", (Class[]) null );
1148 }
1149 catch ( final NoSuchMethodException e )
1150 {
1151 factoryMethod = null;
1152 }
1153 }
1154
1155 return factoryMethod;
1156 }
1157
1158 /**
1159 * Gets a flag indicating the Java class of the instance is assignable to all Java classes of all specifications of
1160 * the instance.
1161 *
1162 * @param classLoader The class loader to get the Java classes from or {@code null}, to get the Java classes from
1163 * the platform's bootstrap class loader.
1164 *
1165 * @return {@code true}, if the Java class of the instance is assignable to all Java classes of all specifications
1166 * of the instance; {@code false}, if the Java class of the instance is not assignable to all Java classes of all
1167 * specifications of the instance.
1168 *
1169 * @throws ClassNotFoundException if a Java class is not found.
1170 *
1171 * @see #getJavaClass(java.lang.ClassLoader)
1172 * @see #getJavaClasses(java.lang.ClassLoader)
1173 *
1174 * @since 1.2
1175 */
1176 public boolean isJavaClassAssignable( final ClassLoader classLoader ) throws ClassNotFoundException
1177 {
1178 boolean assignable = true;
1179 final Class<?> javaClass = this.getJavaClass( classLoader );
1180 final Class<?>[] javaClasses = this.getJavaClasses( classLoader );
1181
1182 for ( int i = javaClasses.length - 1; i >= 0; i-- )
1183 {
1184 if ( !javaClasses[i].isAssignableFrom( javaClass ) )
1185 {
1186 assignable = false;
1187 break;
1188 }
1189 }
1190
1191 return assignable;
1192 }
1193
1194 /**
1195 * Gets the Java proxy class for a given class loader.
1196 *
1197 * @param classLoader The class loader to get the Java proxy class from or {@code null}, to get the Java proxy class
1198 * from the platform's bootstrap class loader.
1199 *
1200 * @return The Java proxy class for {@code classLoader} or {@code null}, if the instance does not support a Java
1201 * proxy class.
1202 *
1203 * @throws ClassNotFoundException if a Java class is not found.
1204 *
1205 * @see #getJavaClasses(java.lang.ClassLoader)
1206 *
1207 * @since 1.2
1208 */
1209 public Class<?> getJavaProxyClass( final ClassLoader classLoader ) throws ClassNotFoundException
1210 {
1211 final Class<?>[] javaClasses = this.getJavaClasses( classLoader );
1212 boolean canProxy = javaClasses.length > 0;
1213
1214 if ( canProxy )
1215 {
1216 for ( int i = javaClasses.length - 1; i >= 0; i-- )
1217 {
1218 if ( !javaClasses[i].isInterface() )
1219 {
1220 canProxy = false;
1221 break;
1222 }
1223 }
1224 }
1225
1226 return canProxy ? java.lang.reflect.Proxy.getProxyClass( classLoader, javaClasses ) : null;
1227 }
1228
1229 /**
1230 * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the
1231 * instance.
1232 *
1233 * @param namespaceURI The namespace URI of the {@code JAXBElement} to return.
1234 * @param localPart The local part of the {@code JAXBElement} to return.
1235 *
1236 * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property
1237 * of the instance or {@code null}, if no such element is found.
1238 *
1239 * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}.
1240 * @throws IllegalStateException if the {@code any} property contains more than one matching element.
1241 *
1242 * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String)
1243 *
1244 * @deprecated As of JOMC 1.1, please use method {@link #getAnyElement(java.lang.String, java.lang.String, java.lang.Class)}.
1245 * This method will be removed in version 2.0.
1246 */
1247 @Deprecated
1248 public javax.xml.bind.JAXBElement getAnyElement( final String namespaceURI, final String localPart )
1249 {
1250 return this.getAnyElement( this.getAny(), namespaceURI, localPart );
1251 }
1252
1253 /**
1254 * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any}
1255 * property of the instance.
1256 *
1257 * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return.
1258 * @param localPart The local part of the {@code JAXBElement}s to return.
1259 *
1260 * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from
1261 * the {@code any} property of the instance - an empty list if no such elements are found.
1262 *
1263 * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}.
1264 *
1265 * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String)
1266 *
1267 * @deprecated As of JOMC 1.1, please use method {@link #getAnyElements(java.lang.String, java.lang.String, java.lang.Class)}.
1268 * This method will be removed in version 2.0.
1269 */
1270 @Deprecated
1271 public java.util.List<javax.xml.bind.JAXBElement> getAnyElements( final String namespaceURI,
1272 final String localPart )
1273 {
1274 return this.getAnyElements( this.getAny(), namespaceURI, localPart );
1275 }
1276
1277 /**
1278 * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the
1279 * instance.
1280 *
1281 * @param namespaceURI The namespace URI of the {@code JAXBElement} to return.
1282 * @param localPart The local part of the {@code JAXBElement} to return.
1283 * @param type The class of the type the element is bound to.
1284 * @param <T> The type the element is bound to.
1285 *
1286 * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property
1287 * of the instance or {@code null}, if no such element is found.
1288 *
1289 * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}.
1290 * @throws IllegalStateException if the {@code any} property contains more than one matching element.
1291 *
1292 * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String, java.lang.Class)
1293 *
1294 * @since 1.1
1295 */
1296 public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart,
1297 final Class<T> type )
1298 {
1299 return this.getAnyElement( this.getAny(), namespaceURI, localPart, type );
1300 }
1301
1302 /**
1303 * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any}
1304 * property of the instance.
1305 *
1306 * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return.
1307 * @param localPart The local part of the {@code JAXBElement}s to return.
1308 * @param type The class of the type the elements are bound to.
1309 * @param <T> The type the elements are bound to.
1310 *
1311 * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from
1312 * the {@code any} property of the instance - an empty list if no such elements are found.
1313 *
1314 * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}.
1315 *
1316 * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String, java.lang.Class)
1317 *
1318 * @since 1.1
1319 */
1320 public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI,
1321 final String localPart,
1322 final Class<T> type )
1323 {
1324 return this.getAnyElements( this.getAny(), namespaceURI, localPart, type );
1325 }
1326
1327 /**
1328 * Gets a single object matching a given class from the {@code any} property of the instance.
1329 *
1330 * @param clazz The class to return an instance of.
1331 * @param <T> The type of the object to return.
1332 *
1333 * @return The instance of {@code clazz} from the {@code any} property of the instance or {@code null} if no such
1334 * instance is found.
1335 *
1336 * @throws NullPointerException if {@code clazz} is {@code null}.
1337 * @throws IllegalStateException if the {@code any} property contains more than one matching object.
1338 *
1339 * @see #getAnyObject(java.util.List, java.lang.Class)
1340 */
1341 public <T> T getAnyObject( final Class<T> clazz )
1342 {
1343 return this.getAnyObject( this.getAny(), clazz );
1344 }
1345
1346 /**
1347 * Gets a list containing all objects matching a given class from the {@code any} property of the instance.
1348 *
1349 * @param clazz The class to return all instances of.
1350 * @param <T> The type of the objects to return.
1351 *
1352 * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} property of the instance -
1353 * an empty list if no such objects are found.
1354 *
1355 * @throws NullPointerException if {@code clazz} is {@code null}.
1356 *
1357 * @see #getAnyObjects(java.util.List, java.lang.Class)
1358 */
1359 public <T> java.util.List<T> getAnyObjects( final Class<T> clazz )
1360 {
1361 return this.getAnyObjects( this.getAny(), clazz );
1362 }
1363
1364 }