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: 2016.11.01 at 03:16:38 AM CET 006// 007 008 009package org.jomc.model; 010 011import java.io.ByteArrayInputStream; 012import java.io.ByteArrayOutputStream; 013import java.io.File; 014import java.io.IOException; 015import java.io.InvalidClassException; 016import java.io.NotSerializableException; 017import java.io.ObjectInputStream; 018import java.io.ObjectOutputStream; 019import java.io.OptionalDataException; 020import java.io.Serializable; 021import java.io.StreamCorruptedException; 022import java.lang.reflect.Array; 023import java.lang.reflect.InvocationTargetException; 024import java.math.BigDecimal; 025import java.math.BigInteger; 026import java.net.MalformedURLException; 027import java.net.URI; 028import java.net.URISyntaxException; 029import java.net.URL; 030import java.util.ArrayList; 031import java.util.Calendar; 032import java.util.Currency; 033import java.util.Date; 034import java.util.Iterator; 035import java.util.List; 036import java.util.Locale; 037import java.util.TimeZone; 038import java.util.UUID; 039import javax.activation.MimeType; 040import javax.activation.MimeTypeParseException; 041import javax.annotation.Generated; 042import javax.xml.bind.JAXBElement; 043import javax.xml.bind.annotation.XmlAccessType; 044import javax.xml.bind.annotation.XmlAccessorType; 045import javax.xml.bind.annotation.XmlAnyElement; 046import javax.xml.bind.annotation.XmlAttribute; 047import javax.xml.bind.annotation.XmlElement; 048import javax.xml.bind.annotation.XmlType; 049import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; 050import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 051import javax.xml.datatype.Duration; 052import javax.xml.datatype.XMLGregorianCalendar; 053import javax.xml.namespace.QName; 054import 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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 107public 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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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.1 Build 2012-03-02T12:09:12+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.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 Object } 235 * {@link Element } 236 * 237 * 238 */ 239 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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 = "2016-11-01T03:16:37+01: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.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 480 private static Object copyOf(final Object o) { 481 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 618 private static Object copyOfArray(final Object array) { 619 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 664 private static boolean[] copyOf(final boolean[] array) { 665 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 683 private static byte[] copyOf(final byte[] array) { 684 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 702 private static char[] copyOf(final char[] array) { 703 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 721 private static double[] copyOf(final double[] array) { 722 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 740 private static float[] copyOf(final float[] array) { 741 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 759 private static int[] copyOf(final int[] array) { 760 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 778 private static long[] copyOf(final long[] array) { 779 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 797 private static short[] copyOf(final short[] array) { 798 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 817 private static JAXBElement copyOf(final JAXBElement element) { 818 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 837 private static Serializable copyOf(final Serializable serializable) { 838 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 878 public Specification clone() { 879 { 880 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+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 type referenced by 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 type referenced by the specification or {@code null}, if the specification does not 914 * reference a type. 915 * 916 * @throws ClassNotFoundException if the Java class is not found. 917 * @throws ModelObjectException if compiling the name of the referenced type to a {@code JavaTypeName} fails. 918 * 919 * @see #getClazz() 920 * @see #getJavaTypeName() 921 * 922 * @since 1.2 923 */ 924 public Class<?> getJavaClass( final ClassLoader classLoader ) 925 throws ClassNotFoundException, ModelObjectException 926 { 927 Class<?> javaClass = null; 928 final JavaTypeName javaTypeName = this.getJavaTypeName(); 929 930 if ( javaTypeName != null ) 931 { 932 javaClass = javaTypeName.getClass( classLoader, false ); 933 } 934 935 return javaClass; 936 } 937 938 /** 939 * Gets the Java type name of the type referenced by the specification. 940 * 941 * @return The Java type name of the type referenced by the specification or {@code null}, if the specification does 942 * not reference a type. 943 * 944 * @throws ModelObjectException if compiling the name of the referenced type to a {@code JavaTypeName} fails. 945 * 946 * @see #getClazz() 947 * 948 * @since 1.4 949 */ 950 public JavaTypeName getJavaTypeName() throws ModelObjectException 951 { 952 try 953 { 954 JavaTypeName javaTypeName = null; 955 956 if ( this.getClazz() != null ) 957 { 958 javaTypeName = JavaTypeName.parse( this.getClazz() ); 959 } 960 961 return javaTypeName; 962 } 963 catch ( final java.text.ParseException e ) 964 { 965 throw new ModelObjectException( getMessage( "javaTypeNameParseException", this.getClazz(), 966 getMessage( e ) ), e ); 967 968 } 969 } 970 971 /** 972 * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the 973 * instance. 974 * 975 * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. 976 * @param localPart The local part of the {@code JAXBElement} to return. 977 * 978 * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property 979 * of the instance or {@code null}, if no such element is found. 980 * 981 * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}. 982 * @throws IllegalStateException if the {@code any} property contains more than one matching element. 983 * 984 * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String) 985 * 986 * @deprecated As of JOMC 1.1, please use method {@link #getAnyElement(java.lang.String, java.lang.String, java.lang.Class)}. 987 * This method will be removed in version 2.0. 988 */ 989 @Deprecated 990 public javax.xml.bind.JAXBElement getAnyElement( final String namespaceURI, final String localPart ) 991 { 992 return this.getAnyElement( this.getAny(), namespaceURI, localPart ); 993 } 994 995 /** 996 * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any} 997 * property of the instance. 998 * 999 * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. 1000 * @param localPart The local part of the {@code JAXBElement}s to return. 1001 * 1002 * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from 1003 * the {@code any} property of the instance - an empty list if no such elements are found. 1004 * 1005 * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}. 1006 * 1007 * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String) 1008 * 1009 * @deprecated As of JOMC 1.1, please use method {@link #getAnyElements(java.lang.String, java.lang.String, java.lang.Class)}. 1010 * This method will be removed in version 2.0. 1011 */ 1012 @Deprecated 1013 public java.util.List<javax.xml.bind.JAXBElement> getAnyElements( final String namespaceURI, 1014 final String localPart ) 1015 { 1016 return this.getAnyElements( this.getAny(), namespaceURI, localPart ); 1017 } 1018 1019 /** 1020 * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the 1021 * instance. 1022 * 1023 * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. 1024 * @param localPart The local part of the {@code JAXBElement} to return. 1025 * @param type The class of the type the element is bound to. 1026 * @param <T> The type the element is bound to. 1027 * 1028 * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property 1029 * of the instance or {@code null} if no such element is found. 1030 * 1031 * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}. 1032 * @throws IllegalStateException if the {@code any} property contains more than one matching element. 1033 * 1034 * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String, java.lang.Class) 1035 * 1036 * @since 1.1 1037 */ 1038 public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart, 1039 final Class<T> type ) 1040 { 1041 return this.getAnyElement( this.getAny(), namespaceURI, localPart, type ); 1042 } 1043 1044 /** 1045 * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any} 1046 * property of the instance. 1047 * 1048 * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. 1049 * @param localPart The local part of the {@code JAXBElement}s to return. 1050 * @param type The class of the type the elements are bound to. 1051 * @param <T> The type the elements are bound to. 1052 * 1053 * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from 1054 * the {@code any} property of the instance - an empty list if no such elements are found. 1055 * 1056 * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}. 1057 * 1058 * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String, java.lang.Class) 1059 * 1060 * @since 1.1 1061 */ 1062 public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI, 1063 final String localPart, 1064 final Class<T> type ) 1065 { 1066 return this.getAnyElements( this.getAny(), namespaceURI, localPart, type ); 1067 } 1068 1069 /** 1070 * Gets a single object matching a given class from the {@code any} property of the instance. 1071 * 1072 * @param clazz The class to return an instance of. 1073 * @param <T> The type of the object to return. 1074 * 1075 * @return The instance of {@code clazz} from the {@code any} property of the instance or {@code null}, if no such 1076 * instance is found. 1077 * 1078 * @throws NullPointerException if {@code clazz} is {@code null}. 1079 * @throws IllegalStateException if the {@code any} property contains more than one matching object. 1080 * 1081 * @see #getAnyObject(java.util.List, java.lang.Class) 1082 */ 1083 public <T> T getAnyObject( final Class<T> clazz ) 1084 { 1085 return this.getAnyObject( this.getAny(), clazz ); 1086 } 1087 1088 /** 1089 * Gets a list containing all objects matching a given class from the {@code any} property of the instance. 1090 * 1091 * @param clazz The class to return all instances of. 1092 * @param <T> The type of the objects to return. 1093 * 1094 * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} property of the instance - 1095 * an empty list if no such objects are found. 1096 * 1097 * @throws NullPointerException if {@code clazz} is {@code null}. 1098 * 1099 * @see #getAnyObjects(java.util.List, java.lang.Class) 1100 */ 1101 public <T> java.util.List<T> getAnyObjects( final Class<T> clazz ) 1102 { 1103 return this.getAnyObjects( this.getAny(), clazz ); 1104 } 1105 1106 private static String getMessage( final Throwable t ) 1107 { 1108 return t != null 1109 ? t.getMessage() != null && t.getMessage().trim().length() > 0 1110 ? t.getMessage() 1111 : getMessage( t.getCause() ) 1112 : null; 1113 1114 } 1115 1116 private static String getMessage( final String key, final Object... arguments ) 1117 { 1118 return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( 1119 Specification.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ). 1120 getString( key ), arguments ); 1121 1122 } 1123 1124}