| 1 | // |
| 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 |
| 3 | // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> |
| 4 | // Any modifications to this file will be lost upon recompilation of the source schema. |
| 5 | // Generated on: 2010.06.29 at 05:36:20 PM CEST |
| 6 | // |
| 7 | |
| 8 | |
| 9 | package org.jomc.sdk.model; |
| 10 | |
| 11 | import java.io.ByteArrayInputStream; |
| 12 | import java.io.ByteArrayOutputStream; |
| 13 | import java.io.IOException; |
| 14 | import java.io.InvalidClassException; |
| 15 | import java.io.NotSerializableException; |
| 16 | import java.io.ObjectInputStream; |
| 17 | import java.io.ObjectOutputStream; |
| 18 | import java.io.OptionalDataException; |
| 19 | import java.io.Serializable; |
| 20 | import java.io.StreamCorruptedException; |
| 21 | import java.lang.reflect.Array; |
| 22 | import java.lang.reflect.InvocationTargetException; |
| 23 | import java.math.BigDecimal; |
| 24 | import java.math.BigInteger; |
| 25 | import java.util.Calendar; |
| 26 | import java.util.Currency; |
| 27 | import java.util.Date; |
| 28 | import java.util.HashMap; |
| 29 | import java.util.Locale; |
| 30 | import java.util.Map; |
| 31 | import java.util.TimeZone; |
| 32 | import java.util.UUID; |
| 33 | import javax.annotation.Generated; |
| 34 | import javax.xml.bind.JAXBElement; |
| 35 | import javax.xml.bind.annotation.XmlAccessType; |
| 36 | import javax.xml.bind.annotation.XmlAccessorType; |
| 37 | import javax.xml.bind.annotation.XmlAnyAttribute; |
| 38 | import javax.xml.bind.annotation.XmlAnyElement; |
| 39 | import javax.xml.bind.annotation.XmlAttribute; |
| 40 | import javax.xml.bind.annotation.XmlType; |
| 41 | import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; |
| 42 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| 43 | import javax.xml.datatype.Duration; |
| 44 | import javax.xml.datatype.XMLGregorianCalendar; |
| 45 | import javax.xml.namespace.QName; |
| 46 | import org.w3c.dom.Element; |
| 47 | |
| 48 | |
| 49 | /** |
| 50 | * |
| 51 | * Model of an item. |
| 52 | * |
| 53 | * The 'ItemType' type defines attributes 'type' and 'value'. Attribute 'type' holds an identifier of the type of the |
| 54 | * item. Attribute 'value' holds the item's value. |
| 55 | * |
| 56 | * |
| 57 | * <p>Java class for ItemType complex type. |
| 58 | * |
| 59 | * <p>The following schema fragment specifies the expected content contained within this class. |
| 60 | * |
| 61 | * <pre> |
| 62 | * <complexType name="ItemType"> |
| 63 | * <complexContent> |
| 64 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
| 65 | * <sequence> |
| 66 | * <any processContents='lax' minOccurs="0"/> |
| 67 | * </sequence> |
| 68 | * <attribute name="type" type="{http://jomc.org/sdk/model}Identifier" /> |
| 69 | * <attribute name="value" type="{http://jomc.org/sdk/model}String" /> |
| 70 | * <anyAttribute processContents='lax'/> |
| 71 | * </restriction> |
| 72 | * </complexContent> |
| 73 | * </complexType> |
| 74 | * </pre> |
| 75 | * |
| 76 | * |
| 77 | */ |
| 78 | @XmlAccessorType(XmlAccessType.FIELD) |
| 79 | @XmlType(name = "ItemType", propOrder = { |
| 80 | "any" |
| 81 | }) |
| 82 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 83 | public class ItemType implements Cloneable |
| 84 | { |
| 85 | |
| 86 | @XmlAnyElement(lax = true) |
| 87 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 88 | protected Object any; |
| 89 | @XmlAttribute |
| 90 | @XmlJavaTypeAdapter(CollapsedStringAdapter.class) |
| 91 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 92 | protected String type; |
| 93 | @XmlAttribute |
| 94 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 95 | protected String value; |
| 96 | @XmlAnyAttribute |
| 97 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 98 | private Map<QName, String> otherAttributes = new HashMap<QName, String>(); |
| 99 | |
| 100 | /** |
| 101 | * Creates a new {@code ItemType} instance. |
| 102 | * |
| 103 | */ |
| 104 | public ItemType() { |
| 105 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 106 | super(); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Creates a new {@code ItemType} instance by deeply copying a given {@code ItemType} instance. |
| 111 | * |
| 112 | * |
| 113 | * @param o |
| 114 | * The instance to copy. |
| 115 | * @throws NullPointerException |
| 116 | * if {@code o} is {@code null}. |
| 117 | */ |
| 118 | public ItemType(final ItemType o) { |
| 119 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 120 | super(); |
| 121 | if (o == null) { |
| 122 | throw new NullPointerException("Cannot create a copy of 'ItemType' from 'null'."); |
| 123 | } |
| 124 | // 'Any' property. |
| 125 | this.any = copyAny(o.getAny()); |
| 126 | // CBuiltinLeafInfo: java.lang.String |
| 127 | this.type = o.getType(); |
| 128 | // CBuiltinLeafInfo: java.lang.String |
| 129 | this.value = o.getValue(); |
| 130 | // Other attributes. |
| 131 | this.otherAttributes.putAll(o.otherAttributes); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * The object value of the item. |
| 136 | * |
| 137 | * @return |
| 138 | * possible object is |
| 139 | * {@link Element } |
| 140 | * {@link Object } |
| 141 | * |
| 142 | */ |
| 143 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 144 | public Object getAny() { |
| 145 | return any; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Sets the value of the any property. |
| 150 | * |
| 151 | * @param value |
| 152 | * allowed object is |
| 153 | * {@link Element } |
| 154 | * {@link Object } |
| 155 | * |
| 156 | */ |
| 157 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 158 | public void setAny(Object value) { |
| 159 | this.any = value; |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * The type of the item value. |
| 164 | * |
| 165 | * @return |
| 166 | * possible object is |
| 167 | * {@link String } |
| 168 | * |
| 169 | */ |
| 170 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 171 | public String getType() { |
| 172 | return type; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Sets the value of the type property. |
| 177 | * |
| 178 | * @param value |
| 179 | * allowed object is |
| 180 | * {@link String } |
| 181 | * |
| 182 | */ |
| 183 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 184 | public void setType(String value) { |
| 185 | this.type = value; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * The string value of the item. |
| 190 | * |
| 191 | * @return |
| 192 | * possible object is |
| 193 | * {@link String } |
| 194 | * |
| 195 | */ |
| 196 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 197 | public String getValue() { |
| 198 | return value; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Sets the value of the value property. |
| 203 | * |
| 204 | * @param value |
| 205 | * allowed object is |
| 206 | * {@link String } |
| 207 | * |
| 208 | */ |
| 209 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 210 | public void setValue(String value) { |
| 211 | this.value = value; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Gets a map that contains attributes that aren't bound to any typed property on this class. |
| 216 | * |
| 217 | * <p> |
| 218 | * the map is keyed by the name of the attribute and |
| 219 | * the value is the string value of the attribute. |
| 220 | * |
| 221 | * the map returned by this method is live, and you can add new attribute |
| 222 | * by updating the map directly. Because of this design, there's no setter. |
| 223 | * |
| 224 | * |
| 225 | * @return |
| 226 | * always non-null |
| 227 | */ |
| 228 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 229 | public Map<QName, String> getOtherAttributes() { |
| 230 | return otherAttributes; |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Creates and returns a deep copy of property {@code Any}. |
| 235 | * |
| 236 | * @param source |
| 237 | * The source to copy from or {@code null}. |
| 238 | * @return |
| 239 | * A deep copy of {@code source} or {@code null} if {@code source} is {@code null}. |
| 240 | */ |
| 241 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 242 | private static Object copyAny(final Object source) { |
| 243 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 244 | if (source!= null) { |
| 245 | if (source instanceof Element) { |
| 246 | // CWildcardTypeInfo: org.w3c.dom.Element |
| 247 | return ((Element)((Element) source).cloneNode(true)); |
| 248 | } |
| 249 | if (source instanceof Object) { |
| 250 | // CBuiltinLeafInfo: java.lang.Object |
| 251 | return copyOfObject(((Object) source)); |
| 252 | } |
| 253 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 254 | throw new AssertionError((("Unexpected instance '"+ source)+"' for property 'Any' of class 'org.jomc.sdk.model.ItemType'.")); |
| 255 | } |
| 256 | return null; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Creates and returns a deep copy of a given object. |
| 261 | * |
| 262 | * @param o |
| 263 | * The instance to copy or {@code null}. |
| 264 | * @return |
| 265 | * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}. |
| 266 | */ |
| 267 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 268 | private static Object copyOfObject(final Object o) { |
| 269 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 270 | if (o!= null) { |
| 271 | if (o.getClass().isPrimitive()) { |
| 272 | return o; |
| 273 | } |
| 274 | if (o.getClass().isArray()) { |
| 275 | return copyOfArray(o); |
| 276 | } |
| 277 | if (o instanceof Boolean) { |
| 278 | return o; |
| 279 | } |
| 280 | if (o instanceof Byte) { |
| 281 | return o; |
| 282 | } |
| 283 | if (o instanceof Character) { |
| 284 | return o; |
| 285 | } |
| 286 | if (o instanceof Double) { |
| 287 | return o; |
| 288 | } |
| 289 | if (o instanceof Enum) { |
| 290 | return o; |
| 291 | } |
| 292 | if (o instanceof Float) { |
| 293 | return o; |
| 294 | } |
| 295 | if (o instanceof Integer) { |
| 296 | return o; |
| 297 | } |
| 298 | if (o instanceof Long) { |
| 299 | return o; |
| 300 | } |
| 301 | if (o instanceof Short) { |
| 302 | return o; |
| 303 | } |
| 304 | if (o instanceof String) { |
| 305 | return o; |
| 306 | } |
| 307 | if (o instanceof BigDecimal) { |
| 308 | return o; |
| 309 | } |
| 310 | if (o instanceof BigInteger) { |
| 311 | return o; |
| 312 | } |
| 313 | if (o instanceof UUID) { |
| 314 | return o; |
| 315 | } |
| 316 | if (o instanceof QName) { |
| 317 | return o; |
| 318 | } |
| 319 | if (o instanceof Duration) { |
| 320 | return o; |
| 321 | } |
| 322 | if (o instanceof Currency) { |
| 323 | return o; |
| 324 | } |
| 325 | if (o instanceof XMLGregorianCalendar) { |
| 326 | return ((XMLGregorianCalendar) o).clone(); |
| 327 | } |
| 328 | if (o instanceof Date) { |
| 329 | return ((Date) o).clone(); |
| 330 | } |
| 331 | if (o instanceof Calendar) { |
| 332 | return ((Calendar) o).clone(); |
| 333 | } |
| 334 | if (o instanceof TimeZone) { |
| 335 | return ((TimeZone) o).clone(); |
| 336 | } |
| 337 | if (o instanceof Locale) { |
| 338 | return ((Locale) o).clone(); |
| 339 | } |
| 340 | if (o instanceof Element) { |
| 341 | return ((Element)((Element) o).cloneNode(true)); |
| 342 | } |
| 343 | if (o instanceof JAXBElement) { |
| 344 | return copyOFJAXBElement(((JAXBElement) o)); |
| 345 | } |
| 346 | try { |
| 347 | return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null)); |
| 348 | } catch (NoSuchMethodException e) { |
| 349 | if (o instanceof Serializable) { |
| 350 | return copyOfSerializable(((Serializable) o)); |
| 351 | } |
| 352 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 353 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
| 354 | } catch (IllegalAccessException e) { |
| 355 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 356 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
| 357 | } catch (InvocationTargetException e) { |
| 358 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 359 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
| 360 | } catch (SecurityException e) { |
| 361 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 362 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
| 363 | } catch (IllegalArgumentException e) { |
| 364 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 365 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
| 366 | } catch (ExceptionInInitializerError e) { |
| 367 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 368 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
| 369 | } |
| 370 | } |
| 371 | return null; |
| 372 | } |
| 373 | |
| 374 | /** |
| 375 | * Creates and returns a deep copy of a given array. |
| 376 | * |
| 377 | * @param array |
| 378 | * The array to copy or {@code null}. |
| 379 | * @return |
| 380 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 381 | */ |
| 382 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 383 | private static Object copyOfArray(final Object array) { |
| 384 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 385 | if (array!= null) { |
| 386 | if (array.getClass() == boolean[].class) { |
| 387 | return copyOf(((boolean[]) array)); |
| 388 | } |
| 389 | if (array.getClass() == byte[].class) { |
| 390 | return copyOf(((byte[]) array)); |
| 391 | } |
| 392 | if (array.getClass() == char[].class) { |
| 393 | return copyOf(((char[]) array)); |
| 394 | } |
| 395 | if (array.getClass() == double[].class) { |
| 396 | return copyOf(((double[]) array)); |
| 397 | } |
| 398 | if (array.getClass() == float[].class) { |
| 399 | return copyOf(((float[]) array)); |
| 400 | } |
| 401 | if (array.getClass() == int[].class) { |
| 402 | return copyOf(((int[]) array)); |
| 403 | } |
| 404 | if (array.getClass() == long[].class) { |
| 405 | return copyOf(((long[]) array)); |
| 406 | } |
| 407 | if (array.getClass() == short[].class) { |
| 408 | return copyOf(((short[]) array)); |
| 409 | } |
| 410 | final int len = Array.getLength(array); |
| 411 | final Object copy = Array.newInstance(array.getClass().getComponentType(), len); |
| 412 | for (int i = (len- 1); (i >= 0); i--) { |
| 413 | Array.set(copy, i, copyOfObject(Array.get(array, i))); |
| 414 | } |
| 415 | return copy; |
| 416 | } |
| 417 | return null; |
| 418 | } |
| 419 | |
| 420 | /** |
| 421 | * Creates and returns a deep copy of a given array. |
| 422 | * |
| 423 | * @param array |
| 424 | * The array to copy or {@code null}. |
| 425 | * @return |
| 426 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 427 | */ |
| 428 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 429 | private static boolean[] copyOf(final boolean[] array) { |
| 430 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 431 | if (array!= null) { |
| 432 | final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
| 433 | System.arraycopy(array, 0, copy, 0, array.length); |
| 434 | return copy; |
| 435 | } |
| 436 | return null; |
| 437 | } |
| 438 | |
| 439 | /** |
| 440 | * Creates and returns a deep copy of a given array. |
| 441 | * |
| 442 | * @param array |
| 443 | * The array to copy or {@code null}. |
| 444 | * @return |
| 445 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 446 | */ |
| 447 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 448 | private static byte[] copyOf(final byte[] array) { |
| 449 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 450 | if (array!= null) { |
| 451 | final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
| 452 | System.arraycopy(array, 0, copy, 0, array.length); |
| 453 | return copy; |
| 454 | } |
| 455 | return null; |
| 456 | } |
| 457 | |
| 458 | /** |
| 459 | * Creates and returns a deep copy of a given array. |
| 460 | * |
| 461 | * @param array |
| 462 | * The array to copy or {@code null}. |
| 463 | * @return |
| 464 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 465 | */ |
| 466 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 467 | private static char[] copyOf(final char[] array) { |
| 468 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 469 | if (array!= null) { |
| 470 | final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
| 471 | System.arraycopy(array, 0, copy, 0, array.length); |
| 472 | return copy; |
| 473 | } |
| 474 | return null; |
| 475 | } |
| 476 | |
| 477 | /** |
| 478 | * Creates and returns a deep copy of a given array. |
| 479 | * |
| 480 | * @param array |
| 481 | * The array to copy or {@code null}. |
| 482 | * @return |
| 483 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 484 | */ |
| 485 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 486 | private static double[] copyOf(final double[] array) { |
| 487 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 488 | if (array!= null) { |
| 489 | final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
| 490 | System.arraycopy(array, 0, copy, 0, array.length); |
| 491 | return copy; |
| 492 | } |
| 493 | return null; |
| 494 | } |
| 495 | |
| 496 | /** |
| 497 | * Creates and returns a deep copy of a given array. |
| 498 | * |
| 499 | * @param array |
| 500 | * The array to copy or {@code null}. |
| 501 | * @return |
| 502 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 503 | */ |
| 504 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 505 | private static float[] copyOf(final float[] array) { |
| 506 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 507 | if (array!= null) { |
| 508 | final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
| 509 | System.arraycopy(array, 0, copy, 0, array.length); |
| 510 | return copy; |
| 511 | } |
| 512 | return null; |
| 513 | } |
| 514 | |
| 515 | /** |
| 516 | * Creates and returns a deep copy of a given array. |
| 517 | * |
| 518 | * @param array |
| 519 | * The array to copy or {@code null}. |
| 520 | * @return |
| 521 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 522 | */ |
| 523 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 524 | private static int[] copyOf(final int[] array) { |
| 525 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 526 | if (array!= null) { |
| 527 | final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
| 528 | System.arraycopy(array, 0, copy, 0, array.length); |
| 529 | return copy; |
| 530 | } |
| 531 | return null; |
| 532 | } |
| 533 | |
| 534 | /** |
| 535 | * Creates and returns a deep copy of a given array. |
| 536 | * |
| 537 | * @param array |
| 538 | * The array to copy or {@code null}. |
| 539 | * @return |
| 540 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 541 | */ |
| 542 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 543 | private static long[] copyOf(final long[] array) { |
| 544 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 545 | if (array!= null) { |
| 546 | final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
| 547 | System.arraycopy(array, 0, copy, 0, array.length); |
| 548 | return copy; |
| 549 | } |
| 550 | return null; |
| 551 | } |
| 552 | |
| 553 | /** |
| 554 | * Creates and returns a deep copy of a given array. |
| 555 | * |
| 556 | * @param array |
| 557 | * The array to copy or {@code null}. |
| 558 | * @return |
| 559 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
| 560 | */ |
| 561 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 562 | private static short[] copyOf(final short[] array) { |
| 563 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 564 | if (array!= null) { |
| 565 | final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
| 566 | System.arraycopy(array, 0, copy, 0, array.length); |
| 567 | return copy; |
| 568 | } |
| 569 | return null; |
| 570 | } |
| 571 | |
| 572 | /** |
| 573 | * Creates and returns a deep copy of a given {@code JAXBElement} instance. |
| 574 | * |
| 575 | * @param element |
| 576 | * The instance to copy or {@code null}. |
| 577 | * @return |
| 578 | * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. |
| 579 | */ |
| 580 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 581 | private static JAXBElement copyOFJAXBElement(final JAXBElement element) { |
| 582 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 583 | if (element!= null) { |
| 584 | final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); |
| 585 | copy.setNil(element.isNil()); |
| 586 | copy.setValue(copyOfObject(copy.getValue())); |
| 587 | return copy; |
| 588 | } |
| 589 | return null; |
| 590 | } |
| 591 | |
| 592 | /** |
| 593 | * Creates and returns a deep copy of a given {@code Serializable}. |
| 594 | * |
| 595 | * @param serializable |
| 596 | * The instance to copy or {@code null}. |
| 597 | * @return |
| 598 | * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}. |
| 599 | */ |
| 600 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 601 | private static Serializable copyOfSerializable(final Serializable serializable) { |
| 602 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 603 | if (serializable!= null) { |
| 604 | try { |
| 605 | final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream(); |
| 606 | final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput); |
| 607 | out.writeObject(serializable); |
| 608 | out.close(); |
| 609 | final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray()); |
| 610 | final ObjectInputStream in = new ObjectInputStream(byteArrayInput); |
| 611 | final Serializable copy = ((Serializable) in.readObject()); |
| 612 | in.close(); |
| 613 | return copy; |
| 614 | } catch (SecurityException e) { |
| 615 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
| 616 | } catch (ClassNotFoundException e) { |
| 617 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
| 618 | } catch (InvalidClassException e) { |
| 619 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
| 620 | } catch (NotSerializableException e) { |
| 621 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
| 622 | } catch (StreamCorruptedException e) { |
| 623 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
| 624 | } catch (OptionalDataException e) { |
| 625 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
| 626 | } catch (IOException e) { |
| 627 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
| 628 | } |
| 629 | } |
| 630 | return null; |
| 631 | } |
| 632 | |
| 633 | /** |
| 634 | * Creates and returns a deep copy of this object. |
| 635 | * |
| 636 | * |
| 637 | * @return |
| 638 | * A deep copy of this object. |
| 639 | */ |
| 640 | @Override |
| 641 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-06-29T05:36:20+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
| 642 | public ItemType clone() { |
| 643 | // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 |
| 644 | return new ItemType(this); |
| 645 | } |
| 646 | |
| 647 | /** |
| 648 | * Gets the Java value of the item. |
| 649 | * <p>The Java value of the item is computed based on the following rules: |
| 650 | * <ol> |
| 651 | * <li>If property {@code any} is set, the Java value is computed based on the object returned by method |
| 652 | * {@code getAny()} by possibly unwrapping any {@code JAXBElement} instances. If that object declares a |
| 653 | * <blockquote><pre>public Object getJavaValue( ClassLoader )</pre></blockquote> method, the value returned by this |
| 654 | * method is the object returned by a call to that method using reflection. If that object does not declare such a |
| 655 | * method, the value returned by this method is that (possibly unwrapped) object.</li> |
| 656 | * <li>If property {@code value} is set, the Java value is computed based on the values of properties {@code type} |
| 657 | * and {@code value}. If property {@code type} is not set or equals {@code java.lang.String}, the value returned |
| 658 | * by this method is the string value returned by method {@code getValue()}. If property {@code type} equals a name |
| 659 | * of a Java primitive type, an instance of the wrapper class corresponding to that primitive type name is returned |
| 660 | * instantiated by passing the value of property {@code value} to the public constructor taking a single |
| 661 | * {@code java.lang.String} argument of that wrapper class. For all other values of property {@code type} an |
| 662 | * instance of a class with a name equal to the value of property {@code type} is returned instantiated by passing |
| 663 | * the value of property {@code value} to the public constructor taking a single {@code java.lang.String} argument |
| 664 | * of that class.</li> |
| 665 | * <li>If properties {@code any} and {@code value} are both {@code null}, this method returns {@code null}.</li> |
| 666 | * </ol></p> |
| 667 | * |
| 668 | * @param classLoader The class loader to use for getting the Java value; {@code null} to use the platform's |
| 669 | * bootstrap class loader. |
| 670 | * |
| 671 | * @return The Java value of the item or {@code null}. |
| 672 | * |
| 673 | * @throws org.jomc.model.PropertyException if getting the Java value of the item fails. |
| 674 | */ |
| 675 | public Object getJavaValue( final ClassLoader classLoader ) throws org.jomc.model.PropertyException |
| 676 | { |
| 677 | try |
| 678 | { |
| 679 | if ( this.getAny() != null ) |
| 680 | { |
| 681 | if ( this.getType() == null ) |
| 682 | { |
| 683 | throw new org.jomc.model.PropertyException( getMessage( "objectWithoutType" ) ); |
| 684 | } |
| 685 | |
| 686 | String typeName = this.getType(); |
| 687 | final int idx = typeName.indexOf( "<" ); |
| 688 | if ( idx != -1 ) |
| 689 | { |
| 690 | typeName = typeName.substring( 0, idx ); |
| 691 | } |
| 692 | |
| 693 | final Class javaType = Class.forName( typeName, true, classLoader ); |
| 694 | final Object anyObject = this.getAny() instanceof JAXBElement |
| 695 | ? ( (JAXBElement) this.getAny() ).getValue() : this.getAny(); |
| 696 | |
| 697 | return ReflectionHelper.getJavaValue( classLoader, anyObject, javaType ); |
| 698 | } |
| 699 | |
| 700 | Class javaType = String.class; |
| 701 | boolean primitive = false; |
| 702 | |
| 703 | if ( this.getType() != null ) |
| 704 | { |
| 705 | if ( Boolean.TYPE.getName().equals( this.getType() ) ) |
| 706 | { |
| 707 | javaType = Boolean.class; |
| 708 | primitive = true; |
| 709 | } |
| 710 | else if ( Byte.TYPE.getName().equals( this.getType() ) ) |
| 711 | { |
| 712 | javaType = Byte.class; |
| 713 | primitive = true; |
| 714 | } |
| 715 | else if ( Character.TYPE.getName().equals( this.getType() ) ) |
| 716 | { |
| 717 | javaType = Character.class; |
| 718 | primitive = true; |
| 719 | } |
| 720 | else if ( Double.TYPE.getName().equals( this.getType() ) ) |
| 721 | { |
| 722 | javaType = Double.class; |
| 723 | primitive = true; |
| 724 | } |
| 725 | else if ( Float.TYPE.getName().equals( this.getType() ) ) |
| 726 | { |
| 727 | javaType = Float.class; |
| 728 | primitive = true; |
| 729 | } |
| 730 | else if ( Integer.TYPE.getName().equals( this.getType() ) ) |
| 731 | { |
| 732 | javaType = Integer.class; |
| 733 | primitive = true; |
| 734 | } |
| 735 | else if ( Long.TYPE.getName().equals( this.getType() ) ) |
| 736 | { |
| 737 | javaType = Long.class; |
| 738 | primitive = true; |
| 739 | } |
| 740 | else if ( Short.TYPE.getName().equals( this.getType() ) ) |
| 741 | { |
| 742 | javaType = Short.class; |
| 743 | primitive = true; |
| 744 | } |
| 745 | else |
| 746 | { |
| 747 | String typeName = this.getType(); |
| 748 | final int idx = typeName.indexOf( "<" ); |
| 749 | if ( idx != -1 ) |
| 750 | { |
| 751 | typeName = typeName.substring( 0, idx ); |
| 752 | } |
| 753 | |
| 754 | javaType = Class.forName( typeName, true, classLoader ); |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | if ( this.getValue() == null && primitive ) |
| 759 | { |
| 760 | throw new org.jomc.model.PropertyException( getMessage( "objectWithoutValue", this.getType() ) ); |
| 761 | } |
| 762 | |
| 763 | return ReflectionHelper.getJavaValue( javaType, this.getValue() ); |
| 764 | } |
| 765 | catch ( final ClassNotFoundException e ) |
| 766 | { |
| 767 | throw new org.jomc.model.PropertyException( getMessage( "classNotFound", this.getType() ), e ); |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | private static String getMessage( final String key, final Object... arguments ) |
| 772 | { |
| 773 | return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( |
| 774 | ItemType.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ).getString( key ), arguments ); |
| 775 | |
| 776 | } |
| 777 | |
| 778 | |
| 779 | } |