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.03.28 at 01:26:51 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 a specification. 060 * 061 * The 'Specification' type defines attributes 'identifier', 'class', 'classDeclaration', 'vendor', 'version', 062 * 'multiplicity' and 'scope'. Attribute 'identifier' holds an identifier uniquely identifying the specification in a set 063 * of specifications. Attribute 'class' holds the identifier of the class providing the programming interface of the 064 * specification. Attribute 'classDeclaration' flags the specification declaring the class providing the programming 065 * interface. Attribute 'vendor' holds information regarding the vendor of the specification. Attribute 'version' holds the 066 * version of the specification. Attribute 'multiplicity' specifies the number of implementations allowed to exist among a 067 * set of modules. A specification with a multiplicity equal to 'One' specifies that no more than one implementation of the 068 * specification is allowed to exist among a set of modules (including none). A specification with a multiplicity equal to 069 * 'Many' specifies that multiple implementations of the specification are allowed to exist among a set of modules 070 * (including none). Attribute 'scope' specifies the scope instances of implementations apply to. In 'Singleton' scope, 071 * objects are bound to a system's single instance store - an object is only created if not already available in that 072 * single instance store. 073 * 074 * 075 * <p>Java class for Specification complex type. 076 * 077 * <p>The following schema fragment specifies the expected content contained within this class. 078 * 079 * <pre> 080 * <complexType name="Specification"> 081 * <complexContent> 082 * <extension base="{http://jomc.org/model}ModelObject"> 083 * <sequence> 084 * <element ref="{http://jomc.org/model}properties" minOccurs="0"/> 085 * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> 086 * </sequence> 087 * <attribute name="identifier" use="required" type="{http://jomc.org/model}Identifier" /> 088 * <attribute name="class" type="{http://jomc.org/model}Identifier" /> 089 * <attribute name="vendor" type="{http://jomc.org/model}String" /> 090 * <attribute name="version" type="{http://jomc.org/model}Version" /> 091 * <attribute name="multiplicity" type="{http://jomc.org/model}Multiplicity" default="Many" /> 092 * <attribute name="scope" type="{http://jomc.org/model}Identifier" /> 093 * <attribute name="classDeclaration" type="{http://jomc.org/model}Flag" default="false" /> 094 * </extension> 095 * </complexContent> 096 * </complexType> 097 * </pre> 098 * 099 * 100 */ 101 @XmlAccessorType(XmlAccessType.FIELD) 102 @XmlType(name = "Specification", namespace = "http://jomc.org/model", propOrder = { 103 "properties", 104 "any" 105 }) 106 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 107 public class Specification 108 extends ModelObject 109 implements Cloneable 110 { 111 112 @XmlElement(namespace = "http://jomc.org/model") 113 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 114 protected Properties properties; 115 @XmlAnyElement(lax = true) 116 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 117 protected List<Object> any; 118 @XmlAttribute(name = "identifier", required = true) 119 @XmlJavaTypeAdapter(CollapsedStringAdapter.class) 120 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 121 protected String identifier; 122 @XmlAttribute(name = "class") 123 @XmlJavaTypeAdapter(CollapsedStringAdapter.class) 124 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 125 protected String clazz; 126 @XmlAttribute(name = "vendor") 127 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 128 protected String vendor; 129 @XmlAttribute(name = "version") 130 @XmlJavaTypeAdapter(CollapsedStringAdapter.class) 131 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 132 protected String version; 133 @XmlAttribute(name = "multiplicity") 134 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 135 protected Multiplicity multiplicity; 136 @XmlAttribute(name = "scope") 137 @XmlJavaTypeAdapter(CollapsedStringAdapter.class) 138 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 139 protected String scope; 140 @XmlAttribute(name = "classDeclaration") 141 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 142 protected Boolean classDeclaration; 143 144 /** 145 * Creates a new {@code Specification} instance. 146 * 147 */ 148 public Specification() { 149 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 150 super(); 151 } 152 153 /** 154 * Creates a new {@code Specification} instance by deeply copying a given {@code Specification} instance. 155 * 156 * 157 * @param o 158 * The instance to copy. 159 * @throws NullPointerException 160 * if {@code o} is {@code null}. 161 */ 162 public Specification(final Specification o) { 163 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 164 super(o); 165 if (o == null) { 166 throw new NullPointerException("Cannot create a copy of 'Specification' from 'null'."); 167 } 168 // CClassInfo: org.jomc.model.Properties 169 this.properties = ((o.properties == null)?null:((o.getProperties() == null)?null:o.getProperties().clone())); 170 // 'Any' collection. 171 if (o.any!= null) { 172 copyAny(o.getAny(), this.getAny()); 173 } 174 // CBuiltinLeafInfo: java.lang.String 175 this.identifier = ((o.identifier == null)?null:o.getIdentifier()); 176 // CBuiltinLeafInfo: java.lang.String 177 this.clazz = ((o.clazz == null)?null:o.getClazz()); 178 // CBuiltinLeafInfo: java.lang.String 179 this.vendor = ((o.vendor == null)?null:o.getVendor()); 180 // CBuiltinLeafInfo: java.lang.String 181 this.version = ((o.version == null)?null:o.getVersion()); 182 // CEnumLeafInfo: org.jomc.model.Multiplicity 183 this.multiplicity = ((o.multiplicity == null)?null:o.getMultiplicity()); 184 // CBuiltinLeafInfo: java.lang.String 185 this.scope = ((o.scope == null)?null:o.getScope()); 186 // CBuiltinLeafInfo: java.lang.Boolean 187 this.classDeclaration = ((o.classDeclaration == null)?null:o.isClassDeclaration()); 188 } 189 190 /** 191 * Properties of this specification or {@code null}. 192 * 193 * @return 194 * possible object is 195 * {@link Properties } 196 * 197 */ 198 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 199 public Properties getProperties() { 200 return properties; 201 } 202 203 /** 204 * Sets the value of the properties property. 205 * 206 * @param value 207 * allowed object is 208 * {@link Properties } 209 * 210 */ 211 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 212 public void setProperties(Properties value) { 213 this.properties = value; 214 } 215 216 /** 217 * Gets the value of the any property. 218 * 219 * <p> 220 * This accessor method returns a reference to the live list, 221 * not a snapshot. Therefore any modification you make to the 222 * returned list will be present inside the JAXB object. 223 * This is why there is not a <CODE>set</CODE> method for the any property. 224 * 225 * <p> 226 * For example, to add a new item, do as follows: 227 * <pre> 228 * getAny().add(newItem); 229 * </pre> 230 * 231 * 232 * <p> 233 * Objects of the following type(s) are allowed in the list 234 * {@link Element } 235 * {@link Object } 236 * 237 * 238 */ 239 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 240 public List<Object> getAny() { 241 if (any == null) { 242 any = new ArrayList<Object>(); 243 } 244 return this.any; 245 } 246 247 /** 248 * The identifier of this specification. 249 * 250 * @return 251 * possible object is 252 * {@link String } 253 * 254 */ 255 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 256 public String getIdentifier() { 257 return identifier; 258 } 259 260 /** 261 * Sets the value of the identifier property. 262 * 263 * @param value 264 * allowed object is 265 * {@link String } 266 * 267 */ 268 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 269 public void setIdentifier(String value) { 270 this.identifier = value; 271 } 272 273 /** 274 * The identifier of the class providing the programming interface of this specification or {@code null}. 275 * 276 * @return 277 * possible object is 278 * {@link String } 279 * 280 */ 281 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 282 public String getClazz() { 283 return clazz; 284 } 285 286 /** 287 * Sets the value of the clazz property. 288 * 289 * @param value 290 * allowed object is 291 * {@link String } 292 * 293 */ 294 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 295 public void setClazz(String value) { 296 this.clazz = value; 297 } 298 299 /** 300 * The vendor of this specification or {@code null}. 301 * 302 * @return 303 * possible object is 304 * {@link String } 305 * 306 */ 307 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 308 public String getVendor() { 309 return vendor; 310 } 311 312 /** 313 * Sets the value of the vendor property. 314 * 315 * @param value 316 * allowed object is 317 * {@link String } 318 * 319 */ 320 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 321 public void setVendor(String value) { 322 this.vendor = value; 323 } 324 325 /** 326 * The version of this specification or {@code null}. 327 * 328 * @return 329 * possible object is 330 * {@link String } 331 * 332 */ 333 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 334 public String getVersion() { 335 return version; 336 } 337 338 /** 339 * Sets the value of the version property. 340 * 341 * @param value 342 * allowed object is 343 * {@link String } 344 * 345 */ 346 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 347 public void setVersion(String value) { 348 this.version = value; 349 } 350 351 /** 352 * The implementation multiplicity of this specification. A multiplicity equal to {@link Multiplicity#ONE} specifies that no more than one implementation of the specification is allowed to exist among a set of modules (including none). A multiplicity equal to {@link Multiplicity#MANY} specifies that many implementations are allowed to exist among a set of modules (including none). 353 * 354 * @return 355 * possible object is 356 * {@link Multiplicity } 357 * 358 */ 359 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 360 public Multiplicity getMultiplicity() { 361 if (multiplicity == null) { 362 return Multiplicity.MANY; 363 } else { 364 return multiplicity; 365 } 366 } 367 368 /** 369 * Sets the value of the multiplicity property. 370 * 371 * @param value 372 * allowed object is 373 * {@link Multiplicity } 374 * 375 */ 376 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 377 public void setMultiplicity(Multiplicity value) { 378 this.multiplicity = value; 379 } 380 381 /** 382 * Scope instances of implementations of this specification apply to or {@code null}, if instances of implementations of this specification are not bound to any scope (multiton). 383 * 384 * @return 385 * possible object is 386 * {@link String } 387 * 388 */ 389 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 390 public String getScope() { 391 return scope; 392 } 393 394 /** 395 * Sets the value of the scope property. 396 * 397 * @param value 398 * allowed object is 399 * {@link String } 400 * 401 */ 402 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 403 public void setScope(String value) { 404 this.scope = value; 405 } 406 407 /** 408 * {@code true}, if this specification declares the class given by property {@code clazz}. 409 * 410 * @return 411 * possible object is 412 * {@link Boolean } 413 * 414 */ 415 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 416 public boolean isClassDeclaration() { 417 if (classDeclaration == null) { 418 return false; 419 } else { 420 return classDeclaration; 421 } 422 } 423 424 /** 425 * Sets the value of the classDeclaration property. 426 * 427 * @param value 428 * allowed object is 429 * {@link Boolean } 430 * 431 */ 432 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 433 public void setClassDeclaration(Boolean value) { 434 this.classDeclaration = value; 435 } 436 437 /** 438 * Copies all values of property {@code Any} deeply. 439 * 440 * @param source 441 * The source to copy from. 442 * @param target 443 * The target to copy {@code source} to. 444 * @throws NullPointerException 445 * if {@code target} is {@code null}. 446 */ 447 @SuppressWarnings("unchecked") 448 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 449 private static void copyAny(final List<Object> source, final List<Object> target) { 450 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 451 if ((source!= null)&&(!source.isEmpty())) { 452 for (final Iterator<?> it = source.iterator(); it.hasNext(); ) { 453 final Object next = it.next(); 454 if (next instanceof Element) { 455 // CWildcardTypeInfo: org.w3c.dom.Element 456 target.add(((Element)((Element) next).cloneNode(true))); 457 continue; 458 } 459 if (next instanceof Object) { 460 // CBuiltinLeafInfo: java.lang.Object 461 target.add(copyOf(((Object) next))); 462 continue; 463 } 464 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 465 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.model.Specification'.")); 466 } 467 } 468 } 469 470 /** 471 * Creates and returns a deep copy of a given object. 472 * 473 * @param o 474 * The instance to copy or {@code null}. 475 * @return 476 * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}. 477 */ 478 @SuppressWarnings("unchecked") 479 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 480 private static Object copyOf(final Object o) { 481 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 482 try { 483 if (o!= null) { 484 if (o.getClass().isPrimitive()) { 485 return o; 486 } 487 if (o.getClass().isArray()) { 488 return copyOfArray(o); 489 } 490 // Immutable types. 491 if (o instanceof Boolean) { 492 return o; 493 } 494 if (o instanceof Byte) { 495 return o; 496 } 497 if (o instanceof Character) { 498 return o; 499 } 500 if (o instanceof Double) { 501 return o; 502 } 503 if (o instanceof Enum) { 504 return o; 505 } 506 if (o instanceof Float) { 507 return o; 508 } 509 if (o instanceof Integer) { 510 return o; 511 } 512 if (o instanceof Long) { 513 return o; 514 } 515 if (o instanceof Short) { 516 return o; 517 } 518 if (o instanceof String) { 519 return o; 520 } 521 if (o instanceof BigDecimal) { 522 return o; 523 } 524 if (o instanceof BigInteger) { 525 return o; 526 } 527 if (o instanceof UUID) { 528 return o; 529 } 530 if (o instanceof QName) { 531 return o; 532 } 533 if (o instanceof Duration) { 534 return o; 535 } 536 if (o instanceof Currency) { 537 return o; 538 } 539 // String based types. 540 if (o instanceof File) { 541 return new File(o.toString()); 542 } 543 if (o instanceof URI) { 544 return new URI(o.toString()); 545 } 546 if (o instanceof URL) { 547 return new URL(o.toString()); 548 } 549 if (o instanceof MimeType) { 550 return new MimeType(o.toString()); 551 } 552 // Cloneable types. 553 if (o instanceof XMLGregorianCalendar) { 554 return ((XMLGregorianCalendar) o).clone(); 555 } 556 if (o instanceof Date) { 557 return ((Date) o).clone(); 558 } 559 if (o instanceof Calendar) { 560 return ((Calendar) o).clone(); 561 } 562 if (o instanceof TimeZone) { 563 return ((TimeZone) o).clone(); 564 } 565 if (o instanceof Locale) { 566 return ((Locale) o).clone(); 567 } 568 if (o instanceof Element) { 569 return ((Element)((Element) o).cloneNode(true)); 570 } 571 if (o instanceof JAXBElement) { 572 return copyOf(((JAXBElement) o)); 573 } 574 try { 575 return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null)); 576 } catch (NoSuchMethodException e) { 577 if (o instanceof Serializable) { 578 return copyOf(((Serializable) o)); 579 } 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 (IllegalAccessException 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 (InvocationTargetException 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 (SecurityException 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 } catch (IllegalArgumentException e) { 592 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 593 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 594 } catch (ExceptionInInitializerError e) { 595 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 596 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 597 } 598 } 599 return null; 600 } catch (MalformedURLException e) { 601 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 602 } catch (MimeTypeParseException e) { 603 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 604 } catch (URISyntaxException e) { 605 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 606 } 607 } 608 609 /** 610 * Creates and returns a deep copy of a given array. 611 * 612 * @param array 613 * The array to copy or {@code null}. 614 * @return 615 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 616 */ 617 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 618 private static Object copyOfArray(final Object array) { 619 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 620 if (array!= null) { 621 if (array.getClass() == boolean[].class) { 622 return copyOf(((boolean[]) array)); 623 } 624 if (array.getClass() == byte[].class) { 625 return copyOf(((byte[]) array)); 626 } 627 if (array.getClass() == char[].class) { 628 return copyOf(((char[]) array)); 629 } 630 if (array.getClass() == double[].class) { 631 return copyOf(((double[]) array)); 632 } 633 if (array.getClass() == float[].class) { 634 return copyOf(((float[]) array)); 635 } 636 if (array.getClass() == int[].class) { 637 return copyOf(((int[]) array)); 638 } 639 if (array.getClass() == long[].class) { 640 return copyOf(((long[]) array)); 641 } 642 if (array.getClass() == short[].class) { 643 return copyOf(((short[]) array)); 644 } 645 final int len = Array.getLength(array); 646 final Object copy = Array.newInstance(array.getClass().getComponentType(), len); 647 for (int i = (len- 1); (i >= 0); i--) { 648 Array.set(copy, i, copyOf(Array.get(array, i))); 649 } 650 return copy; 651 } 652 return null; 653 } 654 655 /** 656 * Creates and returns a deep copy of a given array. 657 * 658 * @param array 659 * The array to copy or {@code null}. 660 * @return 661 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 662 */ 663 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 664 private static boolean[] copyOf(final boolean[] array) { 665 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 666 if (array!= null) { 667 final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 668 System.arraycopy(array, 0, copy, 0, array.length); 669 return copy; 670 } 671 return null; 672 } 673 674 /** 675 * Creates and returns a deep copy of a given array. 676 * 677 * @param array 678 * The array to copy or {@code null}. 679 * @return 680 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 681 */ 682 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 683 private static byte[] copyOf(final byte[] array) { 684 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 685 if (array!= null) { 686 final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 687 System.arraycopy(array, 0, copy, 0, array.length); 688 return copy; 689 } 690 return null; 691 } 692 693 /** 694 * Creates and returns a deep copy of a given array. 695 * 696 * @param array 697 * The array to copy or {@code null}. 698 * @return 699 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 700 */ 701 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 702 private static char[] copyOf(final char[] array) { 703 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 704 if (array!= null) { 705 final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 706 System.arraycopy(array, 0, copy, 0, array.length); 707 return copy; 708 } 709 return null; 710 } 711 712 /** 713 * Creates and returns a deep copy of a given array. 714 * 715 * @param array 716 * The array to copy or {@code null}. 717 * @return 718 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 719 */ 720 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 721 private static double[] copyOf(final double[] array) { 722 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 723 if (array!= null) { 724 final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 725 System.arraycopy(array, 0, copy, 0, array.length); 726 return copy; 727 } 728 return null; 729 } 730 731 /** 732 * Creates and returns a deep copy of a given array. 733 * 734 * @param array 735 * The array to copy or {@code null}. 736 * @return 737 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 738 */ 739 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 740 private static float[] copyOf(final float[] array) { 741 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 742 if (array!= null) { 743 final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 744 System.arraycopy(array, 0, copy, 0, array.length); 745 return copy; 746 } 747 return null; 748 } 749 750 /** 751 * Creates and returns a deep copy of a given array. 752 * 753 * @param array 754 * The array to copy or {@code null}. 755 * @return 756 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 757 */ 758 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 759 private static int[] copyOf(final int[] array) { 760 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 761 if (array!= null) { 762 final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 763 System.arraycopy(array, 0, copy, 0, array.length); 764 return copy; 765 } 766 return null; 767 } 768 769 /** 770 * Creates and returns a deep copy of a given array. 771 * 772 * @param array 773 * The array to copy or {@code null}. 774 * @return 775 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 776 */ 777 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 778 private static long[] copyOf(final long[] array) { 779 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 780 if (array!= null) { 781 final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 782 System.arraycopy(array, 0, copy, 0, array.length); 783 return copy; 784 } 785 return null; 786 } 787 788 /** 789 * Creates and returns a deep copy of a given array. 790 * 791 * @param array 792 * The array to copy or {@code null}. 793 * @return 794 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 795 */ 796 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 797 private static short[] copyOf(final short[] array) { 798 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 799 if (array!= null) { 800 final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 801 System.arraycopy(array, 0, copy, 0, array.length); 802 return copy; 803 } 804 return null; 805 } 806 807 /** 808 * Creates and returns a deep copy of a given {@code JAXBElement} instance. 809 * 810 * @param element 811 * The instance to copy or {@code null}. 812 * @return 813 * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. 814 */ 815 @SuppressWarnings("unchecked") 816 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 817 private static JAXBElement copyOf(final JAXBElement element) { 818 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 819 if (element!= null) { 820 final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); 821 copy.setNil(element.isNil()); 822 copy.setValue(copyOf(copy.getValue())); 823 return copy; 824 } 825 return null; 826 } 827 828 /** 829 * Creates and returns a deep copy of a given {@code Serializable}. 830 * 831 * @param serializable 832 * The instance to copy or {@code null}. 833 * @return 834 * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}. 835 */ 836 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 837 private static Serializable copyOf(final Serializable serializable) { 838 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 839 if (serializable!= null) { 840 try { 841 final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream(); 842 final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput); 843 out.writeObject(serializable); 844 out.close(); 845 final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray()); 846 final ObjectInputStream in = new ObjectInputStream(byteArrayInput); 847 final Serializable copy = ((Serializable) in.readObject()); 848 in.close(); 849 return copy; 850 } catch (SecurityException e) { 851 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 852 } catch (ClassNotFoundException e) { 853 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 854 } catch (InvalidClassException e) { 855 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 856 } catch (NotSerializableException e) { 857 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 858 } catch (StreamCorruptedException e) { 859 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 860 } catch (OptionalDataException e) { 861 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 862 } catch (IOException e) { 863 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 864 } 865 } 866 return null; 867 } 868 869 /** 870 * Creates and returns a deep copy of this object. 871 * 872 * 873 * @return 874 * A deep copy of this object. 875 */ 876 @Override 877 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 878 public Specification clone() { 879 { 880 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 881 final Specification clone = ((Specification) super.clone()); 882 // CClassInfo: org.jomc.model.Properties 883 clone.properties = ((this.properties == null)?null:((this.getProperties() == null)?null:this.getProperties().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.clazz = ((this.clazz == null)?null:this.getClazz()); 893 // CBuiltinLeafInfo: java.lang.String 894 clone.vendor = ((this.vendor == null)?null:this.getVendor()); 895 // CBuiltinLeafInfo: java.lang.String 896 clone.version = ((this.version == null)?null:this.getVersion()); 897 // CEnumLeafInfo: org.jomc.model.Multiplicity 898 clone.multiplicity = ((this.multiplicity == null)?null:this.getMultiplicity()); 899 // CBuiltinLeafInfo: java.lang.String 900 clone.scope = ((this.scope == null)?null:this.getScope()); 901 // CBuiltinLeafInfo: java.lang.Boolean 902 clone.classDeclaration = ((this.classDeclaration == null)?null:this.isClassDeclaration()); 903 return clone; 904 } 905 } 906 907 /** 908 * Gets the Java class of the specification for a given class loader. 909 * 910 * @param classLoader The class loader to get the Java class from or {@code null}, to get the Java class from the 911 * platform's bootstrap class loader. 912 * 913 * @return The Java class of the specification or {@code null}, if the specification does not declare a class. 914 * 915 * @throws ClassNotFoundException if the Java class is not found. 916 * 917 * @see #getClazz() 918 * 919 * @since 1.2 920 */ 921 public Class<?> getJavaClass( final ClassLoader classLoader ) throws ClassNotFoundException 922 { 923 return this.getClazz() != null ? Class.forName( this.getClazz(), false, classLoader ) : null; 924 } 925 926 /** 927 * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the 928 * instance. 929 * 930 * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. 931 * @param localPart The local part of the {@code JAXBElement} to return. 932 * 933 * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property 934 * of the instance or {@code null} if no such element is found. 935 * 936 * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}. 937 * @throws IllegalStateException if the {@code any} property contains more than one matching element. 938 * 939 * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String) 940 * 941 * @deprecated As of JOMC 1.1, please use method {@link #getAnyElement(java.lang.String, java.lang.String, java.lang.Class)}. 942 * This method will be removed in version 2.0. 943 */ 944 @Deprecated 945 public javax.xml.bind.JAXBElement getAnyElement( final String namespaceURI, final String localPart ) 946 { 947 return this.getAnyElement( this.getAny(), namespaceURI, localPart ); 948 } 949 950 /** 951 * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any} 952 * property of the instance. 953 * 954 * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. 955 * @param localPart The local part of the {@code JAXBElement}s to return. 956 * 957 * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from 958 * the {@code any} property of the instance - an empty list if no such elements are found. 959 * 960 * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}. 961 * 962 * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String) 963 * 964 * @deprecated As of JOMC 1.1, please use method {@link #getAnyElements(java.lang.String, java.lang.String, java.lang.Class)}. 965 * This method will be removed in version 2.0. 966 */ 967 @Deprecated 968 public java.util.List<javax.xml.bind.JAXBElement> getAnyElements( final String namespaceURI, 969 final String localPart ) 970 { 971 return this.getAnyElements( this.getAny(), namespaceURI, localPart ); 972 } 973 974 /** 975 * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the 976 * instance. 977 * 978 * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. 979 * @param localPart The local part of the {@code JAXBElement} to return. 980 * @param type The class of the type the element is bound to. 981 * @param <T> The type the element is bound to. 982 * 983 * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property 984 * of the instance or {@code null} if no such element is found. 985 * 986 * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}. 987 * @throws IllegalStateException if the {@code any} property contains more than one matching element. 988 * 989 * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String, java.lang.Class) 990 * 991 * @since 1.1 992 */ 993 public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart, 994 final Class<T> type ) 995 { 996 return this.getAnyElement( this.getAny(), namespaceURI, localPart, type ); 997 } 998 999 /** 1000 * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any} 1001 * property of the instance. 1002 * 1003 * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. 1004 * @param localPart The local part of the {@code JAXBElement}s to return. 1005 * @param type The class of the type the elements are bound to. 1006 * @param <T> The type the elements are bound to. 1007 * 1008 * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from 1009 * the {@code any} property of the instance - an empty list if no such elements are found. 1010 * 1011 * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}. 1012 * 1013 * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String, java.lang.Class) 1014 * 1015 * @since 1.1 1016 */ 1017 public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI, 1018 final String localPart, 1019 final Class<T> type ) 1020 { 1021 return this.getAnyElements( this.getAny(), namespaceURI, localPart, type ); 1022 } 1023 1024 /** 1025 * Gets a single object matching a given class from the {@code any} property of the instance. 1026 * 1027 * @param clazz The class to return an instance of. 1028 * @param <T> The type of the object to return. 1029 * 1030 * @return The instance of {@code clazz} from the {@code any} property of the instance or {@code null}, if no such 1031 * instance is found. 1032 * 1033 * @throws NullPointerException if {@code clazz} is {@code null}. 1034 * @throws IllegalStateException if the {@code any} property contains more than one matching object. 1035 * 1036 * @see #getAnyObject(java.util.List, java.lang.Class) 1037 */ 1038 public <T> T getAnyObject( final Class<T> clazz ) 1039 { 1040 return this.getAnyObject( this.getAny(), clazz ); 1041 } 1042 1043 /** 1044 * Gets a list containing all objects matching a given class from the {@code any} property of the instance. 1045 * 1046 * @param clazz The class to return all instances of. 1047 * @param <T> The type of the objects to return. 1048 * 1049 * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} property of the instance - 1050 * an empty list if no such objects are found. 1051 * 1052 * @throws NullPointerException if {@code clazz} is {@code null}. 1053 * 1054 * @see #getAnyObjects(java.util.List, java.lang.Class) 1055 */ 1056 public <T> java.util.List<T> getAnyObjects( final Class<T> clazz ) 1057 { 1058 return this.getAnyObjects( this.getAny(), clazz ); 1059 } 1060 1061 }