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.Calendar; 031import java.util.Currency; 032import java.util.Date; 033import java.util.Locale; 034import java.util.TimeZone; 035import java.util.UUID; 036import javax.activation.MimeType; 037import javax.activation.MimeTypeParseException; 038import javax.annotation.Generated; 039import javax.xml.bind.JAXBElement; 040import javax.xml.bind.annotation.XmlAccessType; 041import javax.xml.bind.annotation.XmlAccessorType; 042import javax.xml.bind.annotation.XmlAnyElement; 043import javax.xml.bind.annotation.XmlAttribute; 044import javax.xml.bind.annotation.XmlType; 045import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; 046import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 047import javax.xml.datatype.Duration; 048import javax.xml.datatype.XMLGregorianCalendar; 049import javax.xml.namespace.QName; 050import org.w3c.dom.Element; 051 052 053/** 054 * 055 * Model of a property. 056 * 057 * The 'Property' type defines attributes 'name', 'type', 'value', 'final' and 'override'. Attribute 'name' holds the name 058 * uniquely identifying the property in a set of properties. Attribute 'type' holds an identifier of the type of the 059 * property. Attribute 'value' holds the properties value. 060 * 061 * 062 * <p>Java class for Property complex type. 063 * 064 * <p>The following schema fragment specifies the expected content contained within this class. 065 * 066 * <pre> 067 * <complexType name="Property"> 068 * <complexContent> 069 * <extension base="{http://jomc.org/model}ModelObject"> 070 * <sequence> 071 * <any processContents='lax' namespace='##other' minOccurs="0"/> 072 * </sequence> 073 * <attribute name="name" use="required" type="{http://jomc.org/model}Identifier" /> 074 * <attribute name="type" type="{http://jomc.org/model}Identifier" /> 075 * <attribute name="value" type="{http://jomc.org/model}String" /> 076 * <attribute name="final" type="{http://jomc.org/model}Flag" default="false" /> 077 * <attribute name="override" type="{http://jomc.org/model}Flag" default="false" /> 078 * </extension> 079 * </complexContent> 080 * </complexType> 081 * </pre> 082 * 083 * 084 */ 085@XmlAccessorType(XmlAccessType.FIELD) 086@XmlType(name = "Property", namespace = "http://jomc.org/model", propOrder = { 087 "any" 088}) 089@Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 090public class Property 091 extends ModelObject 092 implements Cloneable, Inheritable 093{ 094 095 @XmlAnyElement(lax = true) 096 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 097 protected Object any; 098 @XmlAttribute(name = "name", required = true) 099 @XmlJavaTypeAdapter(CollapsedStringAdapter.class) 100 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 101 protected String name; 102 @XmlAttribute(name = "type") 103 @XmlJavaTypeAdapter(CollapsedStringAdapter.class) 104 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 105 protected String type; 106 @XmlAttribute(name = "value") 107 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 108 protected String value; 109 @XmlAttribute(name = "final") 110 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 111 protected Boolean _final; 112 @XmlAttribute(name = "override") 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 Boolean override; 115 116 /** 117 * Creates a new {@code Property} instance. 118 * 119 */ 120 public Property() { 121 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 122 super(); 123 } 124 125 /** 126 * Creates a new {@code Property} instance by deeply copying a given {@code Property} instance. 127 * 128 * 129 * @param o 130 * The instance to copy. 131 * @throws NullPointerException 132 * if {@code o} is {@code null}. 133 */ 134 public Property(final Property o) { 135 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 136 super(o); 137 if (o == null) { 138 throw new NullPointerException("Cannot create a copy of 'Property' from 'null'."); 139 } 140 // 'Any' property. 141 this.any = ((o.any == null)?null:copyOfAny(o.getAny())); 142 // CBuiltinLeafInfo: java.lang.String 143 this.name = ((o.name == null)?null:o.getName()); 144 // CBuiltinLeafInfo: java.lang.String 145 this.type = ((o.type == null)?null:o.getType()); 146 // CBuiltinLeafInfo: java.lang.String 147 this.value = ((o.value == null)?null:o.getValue()); 148 // CBuiltinLeafInfo: java.lang.Boolean 149 this._final = ((o._final == null)?null:o.isFinal()); 150 // CBuiltinLeafInfo: java.lang.Boolean 151 this.override = ((o.override == null)?null:o.isOverride()); 152 } 153 154 /** 155 * Object value of this property or {@code null}. 156 * 157 * @return 158 * possible object is 159 * {@link Object } 160 * {@link Element } 161 * 162 */ 163 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 164 public Object getAny() { 165 return any; 166 } 167 168 /** 169 * Sets the value of the any property. 170 * 171 * @param value 172 * allowed object is 173 * {@link Object } 174 * {@link Element } 175 * 176 */ 177 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 178 public void setAny(Object value) { 179 this.any = value; 180 } 181 182 /** 183 * Name of this property. 184 * 185 * @return 186 * possible object is 187 * {@link String } 188 * 189 */ 190 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 191 public String getName() { 192 return name; 193 } 194 195 /** 196 * Sets the value of the name property. 197 * 198 * @param value 199 * allowed object is 200 * {@link String } 201 * 202 */ 203 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 204 public void setName(String value) { 205 this.name = value; 206 } 207 208 /** 209 * Type of this property or {@code null}. 210 * 211 * @return 212 * possible object is 213 * {@link String } 214 * 215 */ 216 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 217 public String getType() { 218 return type; 219 } 220 221 /** 222 * Sets the value of the type property. 223 * 224 * @param value 225 * allowed object is 226 * {@link String } 227 * 228 */ 229 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 230 public void setType(String value) { 231 this.type = value; 232 } 233 234 /** 235 * String value of this property or {@code null}. 236 * 237 * @return 238 * possible object is 239 * {@link String } 240 * 241 */ 242 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 243 public String getValue() { 244 return value; 245 } 246 247 /** 248 * Sets the value of the value property. 249 * 250 * @param value 251 * allowed 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 void setValue(String value) { 257 this.value = value; 258 } 259 260 /** 261 * {@code true}, if this property is the final node in an inheritance hierarchy. 262 * 263 * @return 264 * possible object is 265 * {@link Boolean } 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 boolean isFinal() { 270 if (_final == null) { 271 return false; 272 } else { 273 return _final; 274 } 275 } 276 277 /** 278 * Sets the value of the final property. 279 * 280 * @param value 281 * allowed object is 282 * {@link Boolean } 283 * 284 */ 285 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 286 public void setFinal(Boolean value) { 287 this._final = value; 288 } 289 290 /** 291 * {@code true}, if this property is intended to override a super property. 292 * 293 * @return 294 * possible object is 295 * {@link Boolean } 296 * 297 */ 298 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 299 public boolean isOverride() { 300 if (override == null) { 301 return false; 302 } else { 303 return override; 304 } 305 } 306 307 /** 308 * Sets the value of the override property. 309 * 310 * @param value 311 * allowed object is 312 * {@link Boolean } 313 * 314 */ 315 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 316 public void setOverride(Boolean value) { 317 this.override = value; 318 } 319 320 /** 321 * Creates and returns a deep copy of property {@code Any}. 322 * 323 * @param source 324 * The source to copy from or {@code null}. 325 * @return 326 * A deep copy of {@code source} or {@code null} if {@code source} is {@code null}. 327 */ 328 @SuppressWarnings("unchecked") 329 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 330 private static Object copyOfAny(final Object source) { 331 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 332 if (source!= null) { 333 if (source instanceof Element) { 334 // CWildcardTypeInfo: org.w3c.dom.Element 335 return ((Element)((Element) source).cloneNode(true)); 336 } 337 if (source instanceof Object) { 338 // CBuiltinLeafInfo: java.lang.Object 339 return copyOf(((Object) source)); 340 } 341 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 342 throw new AssertionError((("Unexpected instance '"+ source)+"' for property 'Any' of class 'org.jomc.model.Property'.")); 343 } 344 return null; 345 } 346 347 /** 348 * Creates and returns a deep copy of a given object. 349 * 350 * @param o 351 * The instance to copy or {@code null}. 352 * @return 353 * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}. 354 */ 355 @SuppressWarnings("unchecked") 356 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 357 private static Object copyOf(final Object o) { 358 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 359 try { 360 if (o!= null) { 361 if (o.getClass().isPrimitive()) { 362 return o; 363 } 364 if (o.getClass().isArray()) { 365 return copyOfArray(o); 366 } 367 // Immutable types. 368 if (o instanceof Boolean) { 369 return o; 370 } 371 if (o instanceof Byte) { 372 return o; 373 } 374 if (o instanceof Character) { 375 return o; 376 } 377 if (o instanceof Double) { 378 return o; 379 } 380 if (o instanceof Enum) { 381 return o; 382 } 383 if (o instanceof Float) { 384 return o; 385 } 386 if (o instanceof Integer) { 387 return o; 388 } 389 if (o instanceof Long) { 390 return o; 391 } 392 if (o instanceof Short) { 393 return o; 394 } 395 if (o instanceof String) { 396 return o; 397 } 398 if (o instanceof BigDecimal) { 399 return o; 400 } 401 if (o instanceof BigInteger) { 402 return o; 403 } 404 if (o instanceof UUID) { 405 return o; 406 } 407 if (o instanceof QName) { 408 return o; 409 } 410 if (o instanceof Duration) { 411 return o; 412 } 413 if (o instanceof Currency) { 414 return o; 415 } 416 // String based types. 417 if (o instanceof File) { 418 return new File(o.toString()); 419 } 420 if (o instanceof URI) { 421 return new URI(o.toString()); 422 } 423 if (o instanceof URL) { 424 return new URL(o.toString()); 425 } 426 if (o instanceof MimeType) { 427 return new MimeType(o.toString()); 428 } 429 // Cloneable types. 430 if (o instanceof XMLGregorianCalendar) { 431 return ((XMLGregorianCalendar) o).clone(); 432 } 433 if (o instanceof Date) { 434 return ((Date) o).clone(); 435 } 436 if (o instanceof Calendar) { 437 return ((Calendar) o).clone(); 438 } 439 if (o instanceof TimeZone) { 440 return ((TimeZone) o).clone(); 441 } 442 if (o instanceof Locale) { 443 return ((Locale) o).clone(); 444 } 445 if (o instanceof Element) { 446 return ((Element)((Element) o).cloneNode(true)); 447 } 448 if (o instanceof JAXBElement) { 449 return copyOf(((JAXBElement) o)); 450 } 451 try { 452 return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null)); 453 } catch (NoSuchMethodException e) { 454 if (o instanceof Serializable) { 455 return copyOf(((Serializable) o)); 456 } 457 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 458 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 459 } catch (IllegalAccessException e) { 460 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 461 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 462 } catch (InvocationTargetException e) { 463 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 464 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 465 } catch (SecurityException e) { 466 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 467 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 468 } catch (IllegalArgumentException e) { 469 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 470 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 471 } catch (ExceptionInInitializerError e) { 472 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 473 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 474 } 475 } 476 return null; 477 } catch (MalformedURLException e) { 478 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 479 } catch (MimeTypeParseException e) { 480 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 481 } catch (URISyntaxException e) { 482 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 483 } 484 } 485 486 /** 487 * Creates and returns a deep copy of a given array. 488 * 489 * @param array 490 * The array to copy or {@code null}. 491 * @return 492 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 493 */ 494 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 495 private static Object copyOfArray(final Object array) { 496 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 497 if (array!= null) { 498 if (array.getClass() == boolean[].class) { 499 return copyOf(((boolean[]) array)); 500 } 501 if (array.getClass() == byte[].class) { 502 return copyOf(((byte[]) array)); 503 } 504 if (array.getClass() == char[].class) { 505 return copyOf(((char[]) array)); 506 } 507 if (array.getClass() == double[].class) { 508 return copyOf(((double[]) array)); 509 } 510 if (array.getClass() == float[].class) { 511 return copyOf(((float[]) array)); 512 } 513 if (array.getClass() == int[].class) { 514 return copyOf(((int[]) array)); 515 } 516 if (array.getClass() == long[].class) { 517 return copyOf(((long[]) array)); 518 } 519 if (array.getClass() == short[].class) { 520 return copyOf(((short[]) array)); 521 } 522 final int len = Array.getLength(array); 523 final Object copy = Array.newInstance(array.getClass().getComponentType(), len); 524 for (int i = (len- 1); (i >= 0); i--) { 525 Array.set(copy, i, copyOf(Array.get(array, i))); 526 } 527 return copy; 528 } 529 return null; 530 } 531 532 /** 533 * Creates and returns a deep copy of a given array. 534 * 535 * @param array 536 * The array to copy or {@code null}. 537 * @return 538 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 539 */ 540 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 541 private static boolean[] copyOf(final boolean[] array) { 542 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 543 if (array!= null) { 544 final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 545 System.arraycopy(array, 0, copy, 0, array.length); 546 return copy; 547 } 548 return null; 549 } 550 551 /** 552 * Creates and returns a deep copy of a given array. 553 * 554 * @param array 555 * The array to copy or {@code null}. 556 * @return 557 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 558 */ 559 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 560 private static byte[] copyOf(final byte[] array) { 561 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 562 if (array!= null) { 563 final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 564 System.arraycopy(array, 0, copy, 0, array.length); 565 return copy; 566 } 567 return null; 568 } 569 570 /** 571 * Creates and returns a deep copy of a given array. 572 * 573 * @param array 574 * The array to copy or {@code null}. 575 * @return 576 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 577 */ 578 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 579 private static char[] copyOf(final char[] array) { 580 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 581 if (array!= null) { 582 final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 583 System.arraycopy(array, 0, copy, 0, array.length); 584 return copy; 585 } 586 return null; 587 } 588 589 /** 590 * Creates and returns a deep copy of a given array. 591 * 592 * @param array 593 * The array to copy or {@code null}. 594 * @return 595 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 596 */ 597 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 598 private static double[] copyOf(final double[] array) { 599 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 600 if (array!= null) { 601 final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 602 System.arraycopy(array, 0, copy, 0, array.length); 603 return copy; 604 } 605 return null; 606 } 607 608 /** 609 * Creates and returns a deep copy of a given array. 610 * 611 * @param array 612 * The array to copy or {@code null}. 613 * @return 614 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 615 */ 616 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 617 private static float[] copyOf(final float[] array) { 618 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 619 if (array!= null) { 620 final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 621 System.arraycopy(array, 0, copy, 0, array.length); 622 return copy; 623 } 624 return null; 625 } 626 627 /** 628 * Creates and returns a deep copy of a given array. 629 * 630 * @param array 631 * The array to copy or {@code null}. 632 * @return 633 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 634 */ 635 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 636 private static int[] copyOf(final int[] array) { 637 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 638 if (array!= null) { 639 final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 640 System.arraycopy(array, 0, copy, 0, array.length); 641 return copy; 642 } 643 return null; 644 } 645 646 /** 647 * Creates and returns a deep copy of a given array. 648 * 649 * @param array 650 * The array to copy or {@code null}. 651 * @return 652 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 653 */ 654 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 655 private static long[] copyOf(final long[] array) { 656 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 657 if (array!= null) { 658 final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 659 System.arraycopy(array, 0, copy, 0, array.length); 660 return copy; 661 } 662 return null; 663 } 664 665 /** 666 * Creates and returns a deep copy of a given array. 667 * 668 * @param array 669 * The array to copy or {@code null}. 670 * @return 671 * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. 672 */ 673 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 674 private static short[] copyOf(final short[] array) { 675 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 676 if (array!= null) { 677 final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length)); 678 System.arraycopy(array, 0, copy, 0, array.length); 679 return copy; 680 } 681 return null; 682 } 683 684 /** 685 * Creates and returns a deep copy of a given {@code JAXBElement} instance. 686 * 687 * @param element 688 * The instance to copy or {@code null}. 689 * @return 690 * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. 691 */ 692 @SuppressWarnings("unchecked") 693 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 694 private static JAXBElement copyOf(final JAXBElement element) { 695 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 696 if (element!= null) { 697 final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); 698 copy.setNil(element.isNil()); 699 copy.setValue(copyOf(copy.getValue())); 700 return copy; 701 } 702 return null; 703 } 704 705 /** 706 * Creates and returns a deep copy of a given {@code Serializable}. 707 * 708 * @param serializable 709 * The instance to copy or {@code null}. 710 * @return 711 * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}. 712 */ 713 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 714 private static Serializable copyOf(final Serializable serializable) { 715 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 716 if (serializable!= null) { 717 try { 718 final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream(); 719 final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput); 720 out.writeObject(serializable); 721 out.close(); 722 final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray()); 723 final ObjectInputStream in = new ObjectInputStream(byteArrayInput); 724 final Serializable copy = ((Serializable) in.readObject()); 725 in.close(); 726 return copy; 727 } catch (SecurityException e) { 728 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 729 } catch (ClassNotFoundException e) { 730 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 731 } catch (InvalidClassException e) { 732 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 733 } catch (NotSerializableException e) { 734 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 735 } catch (StreamCorruptedException e) { 736 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 737 } catch (OptionalDataException e) { 738 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 739 } catch (IOException e) { 740 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); 741 } 742 } 743 return null; 744 } 745 746 /** 747 * Creates and returns a deep copy of this object. 748 * 749 * 750 * @return 751 * A deep copy of this object. 752 */ 753 @Override 754 @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-11-01T03:16:37+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 755 public Property clone() { 756 { 757 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 758 final Property clone = ((Property) super.clone()); 759 // 'Any' property. 760 clone.any = ((this.any == null)?null:copyOfAny(this.getAny())); 761 // CBuiltinLeafInfo: java.lang.String 762 clone.name = ((this.name == null)?null:this.getName()); 763 // CBuiltinLeafInfo: java.lang.String 764 clone.type = ((this.type == null)?null:this.getType()); 765 // CBuiltinLeafInfo: java.lang.String 766 clone.value = ((this.value == null)?null:this.getValue()); 767 // CBuiltinLeafInfo: java.lang.Boolean 768 clone._final = ((this._final == null)?null:this.isFinal()); 769 // CBuiltinLeafInfo: java.lang.Boolean 770 clone.override = ((this.override == null)?null:this.isOverride()); 771 return clone; 772 } 773 } 774 775 /** 776 * Gets the Java value of the property. 777 * <p>The Java value of the property is computed based on the following rules: 778 * <ol> 779 * <li>If property {@code any} is set, the Java value is computed based on the object returned by method 780 * {@code getAny()} by possibly unwrapping any {@code JAXBElement} instances. If that object declares a 781 * <blockquote><pre>public Object getJavaValue( ClassLoader )</pre></blockquote> method, the value returned by this 782 * method is the object returned by a call to that method. If that object does not declare such a method, the value 783 * returned by this method is that (possibly unwrapped) object.</li> 784 * <li>If property {@code value} is set, the Java value is computed based on the values of properties {@code type} 785 * and {@code value}. If property {@code type} is not set or equals {@code java.lang.String}, the value returned 786 * by this method is the string value returned by method {@code getValue()}. If property {@code type} equals a name 787 * of a Java primitive type, an instance of the wrapper class corresponding to that primitive type name is returned 788 * instantiated by passing the value of property {@code value} to the public constructor of that wrapper class 789 * taking a single {@code java.lang.String} argument. For all other values of property {@code type} an instance of 790 * a class with a name equal to the value of property {@code type} is returned, either instantiated by passing the 791 * value of property {@code value} to the public constructor of that class taking a single {@code java.lang.String} 792 * argument, or, failing that, by passing the value of property {@code value} to the static {@code valueOf} method 793 * of that class taking a single {@code java.lang.String} argument.</li> 794 * <li>If properties {@code any} and {@code value} are both {@code null}, this method returns {@code null}.</li> 795 * </ol></p> 796 * 797 * @param classLoader The class loader to use for getting the Java value; {@code null} to use the platform's 798 * bootstrap class loader. 799 * 800 * @return The Java value of the property or {@code null}. 801 * 802 * @throws ModelObjectException if compiling the name of the type to a {@code JavaTypeName} fails. 803 * @throws PropertyException if getting the Java value of the property fails unexpectedly. 804 * 805 * @see #getJavaTypeName() 806 */ 807 public Object getJavaValue( final ClassLoader classLoader ) throws ModelObjectException, PropertyException 808 { 809 try 810 { 811 if ( this.getAny() != null ) 812 { 813 if ( this.getType() == null ) 814 { 815 throw new PropertyException( getMessage( "mandatoryType", this.getName() ) ); 816 } 817 818 final Object anyObject = this.getAny() instanceof JAXBElement 819 ? ( (JAXBElement) this.getAny() ).getValue() : this.getAny(); 820 821 return this.getJavaValue( classLoader, anyObject, 822 this.getJavaTypeName().getClass( classLoader, false ) ); 823 824 } 825 else 826 { 827 if ( this.getJavaTypeName().isPrimitive() && this.getValue() == null ) 828 { 829 throw new PropertyException( getMessage( "mandatoryPrimitiveValue", this.getName(), 830 this.getType() ) ); 831 832 } 833 834 return this.getJavaValue( this.getJavaTypeName().isPrimitive() 835 ? this.getJavaTypeName().getBoxedName().getClass( classLoader, false ) 836 : this.getJavaTypeName().getClass( classLoader, false ), 837 this.getValue() ); 838 839 } 840 } 841 catch ( final ClassNotFoundException e ) 842 { 843 throw new PropertyException( getMessage( "classNotFound", this.getName(), this.getType() ), e ); 844 } 845 } 846 847 /** 848 * Gets the Java type name of the property. 849 * 850 * @return The Java type name of the type referenced by the property or {@code null}, if the property does not 851 * reference a type. 852 * 853 * @throws ModelObjectException if compiling the name of the type referenced by the property to a 854 * {@code JavaTypeName} fails. 855 * 856 * @since 1.4 857 */ 858 public JavaTypeName getJavaTypeName() throws ModelObjectException 859 { 860 final String typeName = this.getType() == null 861 ? this.getAny() == null 862 ? String.class.getName() 863 : Object.class.getName() 864 : this.getType(); 865 866 try 867 { 868 return JavaTypeName.parse( typeName ); 869 } 870 catch ( final java.text.ParseException e ) 871 { 872 throw new ModelObjectException( getMessage( "javaTypeNameParseException", typeName, getMessage( e ) ), e ); 873 } 874 } 875 876 /** 877 * Gets the Java getter method name of the property. 878 * 879 * @return The Java getter method name of the property. 880 * 881 * @throws ModelObjectException if compiling the name of the type referenced by the property to a 882 * {@code JavaTypeName} fails or if compiling the name of the property to a {@code JavaIdentifier} fails. 883 * 884 * @since 1.4 885 * 886 * @see #getName() 887 */ 888 public JavaIdentifier getJavaGetterMethodName() throws ModelObjectException 889 { 890 try 891 { 892 final JavaTypeName javaType = this.getJavaTypeName(); 893 final String prefix = javaType.runtimeEquals( JavaTypeName.BOOLEAN ) 894 || javaType.runtimeEquals( JavaTypeName.BOOLEAN_TYPE ) ? "is" : "get"; 895 896 return JavaIdentifier.parse( prefix + JavaIdentifier.normalize( 897 this.getName() != null ? this.getName() : "", JavaIdentifier.NormalizationMode.CAMEL_CASE ) ); 898 899 } 900 catch ( final java.text.ParseException e ) 901 { 902 throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(), 903 getMessage( e ) ), e ); 904 905 } 906 } 907 908 /** 909 * Gets the Java setter method name of the property. 910 * 911 * @return The Java setter method name of the property. 912 * 913 * @throws ModelObjectException if compiling the name of the property to a {@code JavaIdentifier} fails. 914 * 915 * @since 1.4 916 * 917 * @see #getName() 918 */ 919 public JavaIdentifier getJavaSetterMethodName() throws ModelObjectException 920 { 921 try 922 { 923 return JavaIdentifier.parse( "set" + JavaIdentifier.normalize( 924 this.getName() != null ? this.getName() : "", JavaIdentifier.NormalizationMode.CAMEL_CASE ) ); 925 926 } 927 catch ( final java.text.ParseException e ) 928 { 929 throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(), 930 getMessage( e ) ), e ); 931 932 } 933 } 934 935 /** 936 * Gets the Java variable name of the property. 937 * 938 * @return The Java variable name of the property. 939 * 940 * @throws ModelObjectException if compiling the name of the property to a {@code JavaIdentifier} fails. 941 * 942 * @since 1.4 943 * 944 * @see #getName() 945 */ 946 public JavaIdentifier getJavaVariableName() throws ModelObjectException 947 { 948 try 949 { 950 return JavaIdentifier.normalize( this.getName() != null ? this.getName() : "", 951 JavaIdentifier.NormalizationMode.VARIABLE_NAME_CONVENTION ); 952 953 } 954 catch ( final java.text.ParseException e ) 955 { 956 throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(), 957 getMessage( e ) ), e ); 958 959 } 960 } 961 962 /** 963 * Gets the Java constant name of the message. 964 * 965 * @return The Java constant name of the message. 966 * 967 * @throws ModelObjectException if compiling the name of the property to a {@code JavaIdentifier} fails. 968 * 969 * @since 1.4 970 * 971 * @see #getName() 972 */ 973 public JavaIdentifier getJavaConstantName() throws ModelObjectException 974 { 975 try 976 { 977 return JavaIdentifier.normalize( this.getName() != null ? this.getName() : "", 978 JavaIdentifier.NormalizationMode.CONSTANT_NAME_CONVENTION ); 979 980 } 981 catch ( final java.text.ParseException e ) 982 { 983 throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(), 984 getMessage( e ) ), e ); 985 986 } 987 } 988 989 private Object getJavaValue( final ClassLoader classLoader, final Object any, final Class<?> returnType ) 990 throws PropertyException 991 { 992 if ( any != null ) 993 { 994 final String methodName = "getJavaValue"; 995 996 try 997 { 998 final java.lang.reflect.Method m = any.getClass().getMethod( methodName, ClassLoader.class ); 999 final Object result = m.invoke( any, classLoader ); 1000 1001 if ( result != null && !returnType.isAssignableFrom( result.getClass() ) ) 1002 { 1003 throw new PropertyException( getMessage( "illegalMethodInvocationResult", methodName, 1004 any.getClass().getName(), result.getClass().getName(), 1005 returnType.getName() ) ); 1006 1007 } 1008 1009 return result; 1010 } 1011 catch ( final IllegalAccessException e ) 1012 { 1013 throw new PropertyException( getMessage( "methodAccessDenied", methodName, 1014 any.getClass().getName() ), e ); 1015 1016 } 1017 catch ( final IllegalArgumentException e ) 1018 { 1019 throw new AssertionError( e ); 1020 } 1021 catch ( final InvocationTargetException e ) 1022 { 1023 throw new PropertyException( getMessage( "methodInvocationFailure", methodName, 1024 any.getClass().getName() ), e ); 1025 1026 } 1027 catch ( final SecurityException e ) 1028 { 1029 throw new PropertyException( getMessage( "methodAccessDenied", methodName, 1030 any.getClass().getName() ), e ); 1031 1032 } 1033 catch ( final NoSuchMethodException e ) 1034 { 1035 // Optional method not provided. 1036 } 1037 } 1038 1039 return any; 1040 } 1041 1042 private Object getJavaValue( final Class<?> type, final String value ) throws PropertyException 1043 { 1044 if ( value != null ) 1045 { 1046 try 1047 { 1048 if ( type == Character.class ) 1049 { 1050 if ( value.length() != 1 ) 1051 { 1052 throw new PropertyException( getMessage( "illegalValue", value, Character.class.getName() ) ); 1053 } 1054 1055 return type.getConstructor( char.class ).newInstance( value.charAt( 0 ) ); 1056 } 1057 else if ( type == String.class ) 1058 { 1059 return value; 1060 } 1061 else 1062 { 1063 try 1064 { 1065 return type.getConstructor( String.class ).newInstance( value ); 1066 } 1067 catch ( final NoSuchMethodException e ) 1068 { 1069 // Since 1.5: Try static 'valueOf' method. 1070 final java.lang.reflect.Method valueOf = type.getMethod( "valueOf", String.class ); 1071 1072 if ( !type.isAssignableFrom( valueOf.getReturnType() ) ) 1073 { 1074 throw new PropertyException( getMessage( "notAssignable", valueOf.getReturnType().getName(), 1075 valueOf.getName(), type.getName(), 1076 type.getName(), this.getName() ) ); 1077 1078 } 1079 1080 return valueOf.invoke( null, value ); 1081 } 1082 } 1083 } 1084 catch ( final InstantiationException e ) 1085 { 1086 throw new PropertyException( getMessage( "instantiationException", type.getName() ), e ); 1087 } 1088 catch ( final IllegalAccessException e ) 1089 { 1090 throw new PropertyException( getMessage( "accessDenied", type.getName() ), e ); 1091 } 1092 catch ( final IllegalArgumentException e ) 1093 { 1094 throw new AssertionError( e ); 1095 } 1096 catch ( final InvocationTargetException e ) 1097 { 1098 throw new PropertyException( getMessage( "invocationFailure", type.getName() ), e ); 1099 } 1100 catch ( final NoSuchMethodException e ) 1101 { 1102 throw new PropertyException( getMessage( "constructorNotFound", type.getName() ), e ); 1103 } 1104 } 1105 1106 return value; 1107 } 1108 1109 private static String getMessage( final Throwable t ) 1110 { 1111 return t != null 1112 ? t.getMessage() != null && t.getMessage().trim().length() > 0 1113 ? t.getMessage() 1114 : getMessage( t.getCause() ) 1115 : null; 1116 1117 } 1118 1119 private static String getMessage( final String key, final Object... arguments ) 1120 { 1121 return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( 1122 Property.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ).getString( key ), arguments ); 1123 1124 } 1125 1126}