001 // 002 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 003 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 004 // Any modifications to this file will be lost upon recompilation of the source schema. 005 // Generated on: 2012.04.01 at 02:39:59 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.Calendar; 031 import java.util.Currency; 032 import java.util.Date; 033 import java.util.Locale; 034 import java.util.TimeZone; 035 import java.util.UUID; 036 import javax.activation.MimeType; 037 import javax.activation.MimeTypeParseException; 038 import javax.annotation.Generated; 039 import javax.xml.bind.JAXBElement; 040 import javax.xml.bind.annotation.XmlAccessType; 041 import javax.xml.bind.annotation.XmlAccessorType; 042 import javax.xml.bind.annotation.XmlAnyElement; 043 import javax.xml.bind.annotation.XmlAttribute; 044 import javax.xml.bind.annotation.XmlType; 045 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; 046 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 047 import javax.xml.datatype.Duration; 048 import javax.xml.datatype.XMLGregorianCalendar; 049 import javax.xml.namespace.QName; 050 import 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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 090 public class Property 091 extends ModelObject 092 implements Cloneable, Inheritable 093 { 094 095 @XmlAnyElement(lax = true) 096 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 Build 2011-09-16T18:27:24+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 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02: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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 330 private static Object copyOfAny(final Object source) { 331 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 357 private static Object copyOf(final Object o) { 358 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 (URISyntaxException e) { 480 throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); 481 } catch (MimeTypeParseException 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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 495 private static Object copyOfArray(final Object array) { 496 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 541 private static boolean[] copyOf(final boolean[] array) { 542 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 560 private static byte[] copyOf(final byte[] array) { 561 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 579 private static char[] copyOf(final char[] array) { 580 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 598 private static double[] copyOf(final double[] array) { 599 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 617 private static float[] copyOf(final float[] array) { 618 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 636 private static int[] copyOf(final int[] array) { 637 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 655 private static long[] copyOf(final long[] array) { 656 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 674 private static short[] copyOf(final short[] array) { 675 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 694 private static JAXBElement copyOf(final JAXBElement element) { 695 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 714 private static Serializable copyOf(final Serializable serializable) { 715 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 = "2012-04-01T02:39:59+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 755 public Property clone() { 756 { 757 // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+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 using reflection. If that object does not declare such a 783 * method, the value 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 taking a single 789 * {@code java.lang.String} argument of that wrapper class. For all other values of property {@code type} an 790 * instance of a class with a name equal to the value of property {@code type} is returned instantiated by passing 791 * the value of property {@code value} to the public constructor taking a single {@code java.lang.String} argument 792 * of that class.</li> 793 * <li>If properties {@code any} and {@code value} are both {@code null}, this method returns {@code null}.</li> 794 * </ol></p> 795 * 796 * @param classLoader The class loader to use for getting the Java value; {@code null} to use the platform's 797 * bootstrap class loader. 798 * 799 * @return The Java value of the property or {@code null}. 800 * 801 * @throws PropertyException if getting the Java value of the property fails unexpectedly. 802 */ 803 public Object getJavaValue( final ClassLoader classLoader ) throws PropertyException 804 { 805 try 806 { 807 if ( this.getAny() != null ) 808 { 809 if ( this.getType() == null ) 810 { 811 throw new PropertyException( getMessage( "mandatoryType", this.getName() ) ); 812 } 813 814 String typeName = this.getType(); 815 final int idx = typeName.indexOf( "<" ); 816 if ( idx != -1 ) 817 { 818 typeName = typeName.substring( 0, idx ); 819 } 820 821 final Class<?> javaType = Class.forName( typeName, false, classLoader ); 822 final Object anyObject = this.getAny() instanceof JAXBElement 823 ? ( (JAXBElement) this.getAny() ).getValue() : this.getAny(); 824 825 return this.getJavaValue( classLoader, anyObject, javaType ); 826 } 827 828 Class<?> javaType = String.class; 829 boolean primitive = false; 830 831 if ( this.getType() != null ) 832 { 833 if ( Boolean.TYPE.getName().equals( this.getType() ) ) 834 { 835 javaType = Boolean.class; 836 primitive = true; 837 } 838 else if ( Byte.TYPE.getName().equals( this.getType() ) ) 839 { 840 javaType = Byte.class; 841 primitive = true; 842 } 843 else if ( Character.TYPE.getName().equals( this.getType() ) ) 844 { 845 javaType = Character.class; 846 primitive = true; 847 } 848 else if ( Double.TYPE.getName().equals( this.getType() ) ) 849 { 850 javaType = Double.class; 851 primitive = true; 852 } 853 else if ( Float.TYPE.getName().equals( this.getType() ) ) 854 { 855 javaType = Float.class; 856 primitive = true; 857 } 858 else if ( Integer.TYPE.getName().equals( this.getType() ) ) 859 { 860 javaType = Integer.class; 861 primitive = true; 862 } 863 else if ( Long.TYPE.getName().equals( this.getType() ) ) 864 { 865 javaType = Long.class; 866 primitive = true; 867 } 868 else if ( Short.TYPE.getName().equals( this.getType() ) ) 869 { 870 javaType = Short.class; 871 primitive = true; 872 } 873 else 874 { 875 String typeName = this.getType(); 876 final int idx = typeName.indexOf( "<" ); 877 if ( idx != -1 ) 878 { 879 typeName = typeName.substring( 0, idx ); 880 } 881 882 javaType = Class.forName( typeName, false, classLoader ); 883 } 884 } 885 886 if ( this.getValue() == null && primitive ) 887 { 888 throw new PropertyException( getMessage( "mandatoryPrimitiveValue", this.getName(), this.getType() ) ); 889 } 890 891 return this.getJavaValue( javaType, this.getValue() ); 892 } 893 catch ( final ClassNotFoundException e ) 894 { 895 throw new PropertyException( getMessage( "classNotFound", this.getName(), this.getType() ), e ); 896 } 897 } 898 899 private Object getJavaValue( final ClassLoader classLoader, final Object any, final Class<?> returnType ) 900 throws PropertyException 901 { 902 if ( any != null ) 903 { 904 final String methodName = "getJavaValue"; 905 906 try 907 { 908 final java.lang.reflect.Method m = any.getClass().getMethod( methodName, ClassLoader.class ); 909 final Object result = m.invoke( any, classLoader ); 910 911 if ( result != null && !returnType.isAssignableFrom( result.getClass() ) ) 912 { 913 throw new PropertyException( getMessage( "illegalMethodInvocationResult", methodName, 914 any.getClass().getName(), result.getClass().getName(), 915 returnType.getName() ) ); 916 917 } 918 919 return result; 920 } 921 catch ( final IllegalAccessException e ) 922 { 923 throw new PropertyException( getMessage( "methodAccessDenied", methodName, 924 any.getClass().getName() ), e ); 925 926 } 927 catch ( final IllegalArgumentException e ) 928 { 929 throw new AssertionError( e ); 930 } 931 catch ( final InvocationTargetException e ) 932 { 933 throw new PropertyException( getMessage( "methodInvocationFailure", methodName, 934 any.getClass().getName() ), e ); 935 936 } 937 catch ( final SecurityException e ) 938 { 939 throw new PropertyException( getMessage( "methodAccessDenied", methodName, 940 any.getClass().getName() ), e ); 941 942 } 943 catch ( final NoSuchMethodException e ) 944 { 945 // Optional method not provided. 946 } 947 } 948 949 return any; 950 } 951 952 private Object getJavaValue( final Class<?> type, final String value ) throws PropertyException 953 { 954 if ( value != null ) 955 { 956 try 957 { 958 if ( type == Character.class ) 959 { 960 if ( value.length() != 1 ) 961 { 962 throw new PropertyException( getMessage( "illegalValue", value, Character.class.getName() ) ); 963 } 964 965 return type.getConstructor( new Class<?>[] 966 { 967 char.class 968 } ).newInstance( new Object[] 969 { 970 value.charAt( 0 ) 971 } ); 972 973 } 974 else if ( type == String.class ) 975 { 976 return value; 977 } 978 else 979 { 980 return type.getConstructor( new Class<?>[] 981 { 982 String.class 983 } ).newInstance( value ); 984 985 } 986 } 987 catch ( final InstantiationException e ) 988 { 989 throw new PropertyException( getMessage( "instantiationException", type.getName() ), e ); 990 } 991 catch ( final IllegalAccessException e ) 992 { 993 throw new PropertyException( getMessage( "constructorAccessDenied", type.getName() ), e ); 994 } 995 catch ( final IllegalArgumentException e ) 996 { 997 throw new AssertionError( e ); 998 } 999 catch ( final InvocationTargetException e ) 1000 { 1001 throw new PropertyException( getMessage( "constructorInvocationFailure", type.getName() ), e ); 1002 } 1003 catch ( final NoSuchMethodException e ) 1004 { 1005 throw new PropertyException( getMessage( "constructorNotFound", type.getName() ), e ); 1006 } 1007 } 1008 1009 return value; 1010 } 1011 1012 private static String getMessage( final String key, final Object... arguments ) 1013 { 1014 return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( 1015 Property.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ).getString( key ), arguments ); 1016 1017 } 1018 1019 }