1 | // |
2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 |
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: 2014.02.21 at 04:13:17 AM CET |
6 | // |
7 | |
8 | |
9 | package org.jomc.model; |
10 | |
11 | import java.io.ByteArrayInputStream; |
12 | import java.io.ByteArrayOutputStream; |
13 | import java.io.File; |
14 | import java.io.IOException; |
15 | import java.io.InvalidClassException; |
16 | import java.io.NotSerializableException; |
17 | import java.io.ObjectInputStream; |
18 | import java.io.ObjectOutputStream; |
19 | import java.io.OptionalDataException; |
20 | import java.io.Serializable; |
21 | import java.io.StreamCorruptedException; |
22 | import java.lang.reflect.Array; |
23 | import java.lang.reflect.InvocationTargetException; |
24 | import java.math.BigDecimal; |
25 | import java.math.BigInteger; |
26 | import java.net.MalformedURLException; |
27 | import java.net.URI; |
28 | import java.net.URISyntaxException; |
29 | import java.net.URL; |
30 | import java.util.ArrayList; |
31 | import java.util.Calendar; |
32 | import java.util.Currency; |
33 | import java.util.Date; |
34 | import java.util.Iterator; |
35 | import java.util.List; |
36 | import java.util.Locale; |
37 | import java.util.TimeZone; |
38 | import java.util.UUID; |
39 | import javax.activation.MimeType; |
40 | import javax.activation.MimeTypeParseException; |
41 | import javax.annotation.Generated; |
42 | import javax.xml.bind.JAXBElement; |
43 | import javax.xml.bind.annotation.XmlAccessType; |
44 | import javax.xml.bind.annotation.XmlAccessorType; |
45 | import javax.xml.bind.annotation.XmlAnyElement; |
46 | import javax.xml.bind.annotation.XmlAttribute; |
47 | import javax.xml.bind.annotation.XmlElement; |
48 | import javax.xml.bind.annotation.XmlType; |
49 | import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; |
50 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
51 | import javax.xml.datatype.Duration; |
52 | import javax.xml.datatype.XMLGregorianCalendar; |
53 | import javax.xml.namespace.QName; |
54 | import org.w3c.dom.Element; |
55 | |
56 | |
57 | /** |
58 | * |
59 | * Model of a message. |
60 | * |
61 | * The 'Message' type defines attributes 'name', 'final' and 'override'. Attribute 'name' holds a name uniquely identifying |
62 | * the message in a set of messages. Attribute 'final' flags a message the final node in an inheritance hierarchy. |
63 | * Attribute 'override' flags a message as intended to override a super-message. A message defines a localizable template |
64 | * and format arguments. |
65 | * |
66 | * |
67 | * <p>Java class for Message complex type. |
68 | * |
69 | * <p>The following schema fragment specifies the expected content contained within this class. |
70 | * |
71 | * <pre> |
72 | * <complexType name="Message"> |
73 | * <complexContent> |
74 | * <extension base="{http://jomc.org/model}ModelObject"> |
75 | * <sequence> |
76 | * <element ref="{http://jomc.org/model}template"/> |
77 | * <element ref="{http://jomc.org/model}arguments" minOccurs="0"/> |
78 | * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> |
79 | * </sequence> |
80 | * <attribute name="name" use="required" type="{http://jomc.org/model}Identifier" /> |
81 | * <attribute name="final" type="{http://jomc.org/model}Flag" default="false" /> |
82 | * <attribute name="override" type="{http://jomc.org/model}Flag" default="false" /> |
83 | * </extension> |
84 | * </complexContent> |
85 | * </complexType> |
86 | * </pre> |
87 | * |
88 | * |
89 | */ |
90 | @XmlAccessorType(XmlAccessType.FIELD) |
91 | @XmlType(name = "Message", namespace = "http://jomc.org/model", propOrder = { |
92 | "template", |
93 | "arguments", |
94 | "any" |
95 | }) |
96 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
97 | public class Message |
98 | extends ModelObject |
99 | implements Cloneable, Inheritable |
100 | { |
101 | |
102 | @XmlElement(namespace = "http://jomc.org/model", required = true) |
103 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
104 | protected Texts template; |
105 | @XmlElement(namespace = "http://jomc.org/model") |
106 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
107 | protected Arguments arguments; |
108 | @XmlAnyElement(lax = true) |
109 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
110 | protected List<Object> any; |
111 | @XmlAttribute(name = "name", required = true) |
112 | @XmlJavaTypeAdapter(CollapsedStringAdapter.class) |
113 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
114 | protected String name; |
115 | @XmlAttribute(name = "final") |
116 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
117 | protected Boolean _final; |
118 | @XmlAttribute(name = "override") |
119 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
120 | protected Boolean override; |
121 | |
122 | /** |
123 | * Creates a new {@code Message} instance. |
124 | * |
125 | */ |
126 | public Message() { |
127 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
128 | super(); |
129 | } |
130 | |
131 | /** |
132 | * Creates a new {@code Message} instance by deeply copying a given {@code Message} instance. |
133 | * |
134 | * |
135 | * @param o |
136 | * The instance to copy. |
137 | * @throws NullPointerException |
138 | * if {@code o} is {@code null}. |
139 | */ |
140 | public Message(final Message o) { |
141 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
142 | super(o); |
143 | if (o == null) { |
144 | throw new NullPointerException("Cannot create a copy of 'Message' from 'null'."); |
145 | } |
146 | // CClassInfo: org.jomc.model.Texts |
147 | this.template = ((o.template == null)?null:((o.getTemplate() == null)?null:o.getTemplate().clone())); |
148 | // CClassInfo: org.jomc.model.Arguments |
149 | this.arguments = ((o.arguments == null)?null:((o.getArguments() == null)?null:o.getArguments().clone())); |
150 | // 'Any' collection. |
151 | if (o.any!= null) { |
152 | copyAny(o.getAny(), this.getAny()); |
153 | } |
154 | // CBuiltinLeafInfo: java.lang.String |
155 | this.name = ((o.name == null)?null:o.getName()); |
156 | // CBuiltinLeafInfo: java.lang.Boolean |
157 | this._final = ((o._final == null)?null:o.isFinal()); |
158 | // CBuiltinLeafInfo: java.lang.Boolean |
159 | this.override = ((o.override == null)?null:o.isOverride()); |
160 | } |
161 | |
162 | /** |
163 | * The localizable template of this message. |
164 | * |
165 | * @return |
166 | * possible object is |
167 | * {@link Texts } |
168 | * |
169 | */ |
170 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
171 | public Texts getTemplate() { |
172 | return template; |
173 | } |
174 | |
175 | /** |
176 | * Sets the value of the template property. |
177 | * |
178 | * @param value |
179 | * allowed object is |
180 | * {@link Texts } |
181 | * |
182 | */ |
183 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
184 | public void setTemplate(Texts value) { |
185 | this.template = value; |
186 | } |
187 | |
188 | /** |
189 | * The format arguments of this message or {@code null}. |
190 | * |
191 | * @return |
192 | * possible object is |
193 | * {@link Arguments } |
194 | * |
195 | */ |
196 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
197 | public Arguments getArguments() { |
198 | return arguments; |
199 | } |
200 | |
201 | /** |
202 | * Sets the value of the arguments property. |
203 | * |
204 | * @param value |
205 | * allowed object is |
206 | * {@link Arguments } |
207 | * |
208 | */ |
209 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
210 | public void setArguments(Arguments value) { |
211 | this.arguments = value; |
212 | } |
213 | |
214 | /** |
215 | * Gets the value of the any property. |
216 | * |
217 | * <p> |
218 | * This accessor method returns a reference to the live list, |
219 | * not a snapshot. Therefore any modification you make to the |
220 | * returned list will be present inside the JAXB object. |
221 | * This is why there is not a <CODE>set</CODE> method for the any property. |
222 | * |
223 | * <p> |
224 | * For example, to add a new item, do as follows: |
225 | * <pre> |
226 | * getAny().add(newItem); |
227 | * </pre> |
228 | * |
229 | * |
230 | * <p> |
231 | * Objects of the following type(s) are allowed in the list |
232 | * {@link Element } |
233 | * {@link Object } |
234 | * |
235 | * |
236 | */ |
237 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
238 | public List<Object> getAny() { |
239 | if (any == null) { |
240 | any = new ArrayList<Object>(); |
241 | } |
242 | return this.any; |
243 | } |
244 | |
245 | /** |
246 | * The name of this message. |
247 | * |
248 | * @return |
249 | * possible object is |
250 | * {@link String } |
251 | * |
252 | */ |
253 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
254 | public String getName() { |
255 | return name; |
256 | } |
257 | |
258 | /** |
259 | * Sets the value of the name property. |
260 | * |
261 | * @param value |
262 | * allowed object is |
263 | * {@link String } |
264 | * |
265 | */ |
266 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
267 | public void setName(String value) { |
268 | this.name = value; |
269 | } |
270 | |
271 | /** |
272 | * {@code true}, if this message is the final node in an inheritance hierarchy. |
273 | * |
274 | * @return |
275 | * possible object is |
276 | * {@link Boolean } |
277 | * |
278 | */ |
279 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
280 | public boolean isFinal() { |
281 | if (_final == null) { |
282 | return false; |
283 | } else { |
284 | return _final; |
285 | } |
286 | } |
287 | |
288 | /** |
289 | * Sets the value of the final property. |
290 | * |
291 | * @param value |
292 | * allowed object is |
293 | * {@link Boolean } |
294 | * |
295 | */ |
296 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
297 | public void setFinal(Boolean value) { |
298 | this._final = value; |
299 | } |
300 | |
301 | /** |
302 | * {@code true}, if this message is intended to override a super message. |
303 | * |
304 | * @return |
305 | * possible object is |
306 | * {@link Boolean } |
307 | * |
308 | */ |
309 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
310 | public boolean isOverride() { |
311 | if (override == null) { |
312 | return false; |
313 | } else { |
314 | return override; |
315 | } |
316 | } |
317 | |
318 | /** |
319 | * Sets the value of the override property. |
320 | * |
321 | * @param value |
322 | * allowed object is |
323 | * {@link Boolean } |
324 | * |
325 | */ |
326 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
327 | public void setOverride(Boolean value) { |
328 | this.override = value; |
329 | } |
330 | |
331 | /** |
332 | * Copies all values of property {@code Any} deeply. |
333 | * |
334 | * @param source |
335 | * The source to copy from. |
336 | * @param target |
337 | * The target to copy {@code source} to. |
338 | * @throws NullPointerException |
339 | * if {@code target} is {@code null}. |
340 | */ |
341 | @SuppressWarnings("unchecked") |
342 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
343 | private static void copyAny(final List<Object> source, final List<Object> target) { |
344 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
345 | if ((source!= null)&&(!source.isEmpty())) { |
346 | for (final Iterator<?> it = source.iterator(); it.hasNext(); ) { |
347 | final Object next = it.next(); |
348 | if (next instanceof Element) { |
349 | // CWildcardTypeInfo: org.w3c.dom.Element |
350 | target.add(((Element)((Element) next).cloneNode(true))); |
351 | continue; |
352 | } |
353 | if (next instanceof Object) { |
354 | // CBuiltinLeafInfo: java.lang.Object |
355 | target.add(copyOf(((Object) next))); |
356 | continue; |
357 | } |
358 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
359 | throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.model.Message'.")); |
360 | } |
361 | } |
362 | } |
363 | |
364 | /** |
365 | * Creates and returns a deep copy of a given object. |
366 | * |
367 | * @param o |
368 | * The instance to copy or {@code null}. |
369 | * @return |
370 | * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}. |
371 | */ |
372 | @SuppressWarnings("unchecked") |
373 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
374 | private static Object copyOf(final Object o) { |
375 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
376 | try { |
377 | if (o!= null) { |
378 | if (o.getClass().isPrimitive()) { |
379 | return o; |
380 | } |
381 | if (o.getClass().isArray()) { |
382 | return copyOfArray(o); |
383 | } |
384 | // Immutable types. |
385 | if (o instanceof Boolean) { |
386 | return o; |
387 | } |
388 | if (o instanceof Byte) { |
389 | return o; |
390 | } |
391 | if (o instanceof Character) { |
392 | return o; |
393 | } |
394 | if (o instanceof Double) { |
395 | return o; |
396 | } |
397 | if (o instanceof Enum) { |
398 | return o; |
399 | } |
400 | if (o instanceof Float) { |
401 | return o; |
402 | } |
403 | if (o instanceof Integer) { |
404 | return o; |
405 | } |
406 | if (o instanceof Long) { |
407 | return o; |
408 | } |
409 | if (o instanceof Short) { |
410 | return o; |
411 | } |
412 | if (o instanceof String) { |
413 | return o; |
414 | } |
415 | if (o instanceof BigDecimal) { |
416 | return o; |
417 | } |
418 | if (o instanceof BigInteger) { |
419 | return o; |
420 | } |
421 | if (o instanceof UUID) { |
422 | return o; |
423 | } |
424 | if (o instanceof QName) { |
425 | return o; |
426 | } |
427 | if (o instanceof Duration) { |
428 | return o; |
429 | } |
430 | if (o instanceof Currency) { |
431 | return o; |
432 | } |
433 | // String based types. |
434 | if (o instanceof File) { |
435 | return new File(o.toString()); |
436 | } |
437 | if (o instanceof URI) { |
438 | return new URI(o.toString()); |
439 | } |
440 | if (o instanceof URL) { |
441 | return new URL(o.toString()); |
442 | } |
443 | if (o instanceof MimeType) { |
444 | return new MimeType(o.toString()); |
445 | } |
446 | // Cloneable types. |
447 | if (o instanceof XMLGregorianCalendar) { |
448 | return ((XMLGregorianCalendar) o).clone(); |
449 | } |
450 | if (o instanceof Date) { |
451 | return ((Date) o).clone(); |
452 | } |
453 | if (o instanceof Calendar) { |
454 | return ((Calendar) o).clone(); |
455 | } |
456 | if (o instanceof TimeZone) { |
457 | return ((TimeZone) o).clone(); |
458 | } |
459 | if (o instanceof Locale) { |
460 | return ((Locale) o).clone(); |
461 | } |
462 | if (o instanceof Element) { |
463 | return ((Element)((Element) o).cloneNode(true)); |
464 | } |
465 | if (o instanceof JAXBElement) { |
466 | return copyOf(((JAXBElement) o)); |
467 | } |
468 | try { |
469 | return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null)); |
470 | } catch (NoSuchMethodException e) { |
471 | if (o instanceof Serializable) { |
472 | return copyOf(((Serializable) o)); |
473 | } |
474 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
475 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
476 | } catch (IllegalAccessException e) { |
477 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
478 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
479 | } catch (InvocationTargetException e) { |
480 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
481 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
482 | } catch (SecurityException e) { |
483 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
484 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
485 | } catch (IllegalArgumentException e) { |
486 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
487 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
488 | } catch (ExceptionInInitializerError e) { |
489 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
490 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
491 | } |
492 | } |
493 | return null; |
494 | } catch (MimeTypeParseException e) { |
495 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
496 | } catch (MalformedURLException e) { |
497 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
498 | } catch (URISyntaxException e) { |
499 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
500 | } |
501 | } |
502 | |
503 | /** |
504 | * Creates and returns a deep copy of a given array. |
505 | * |
506 | * @param array |
507 | * The array to copy or {@code null}. |
508 | * @return |
509 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
510 | */ |
511 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
512 | private static Object copyOfArray(final Object array) { |
513 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
514 | if (array!= null) { |
515 | if (array.getClass() == boolean[].class) { |
516 | return copyOf(((boolean[]) array)); |
517 | } |
518 | if (array.getClass() == byte[].class) { |
519 | return copyOf(((byte[]) array)); |
520 | } |
521 | if (array.getClass() == char[].class) { |
522 | return copyOf(((char[]) array)); |
523 | } |
524 | if (array.getClass() == double[].class) { |
525 | return copyOf(((double[]) array)); |
526 | } |
527 | if (array.getClass() == float[].class) { |
528 | return copyOf(((float[]) array)); |
529 | } |
530 | if (array.getClass() == int[].class) { |
531 | return copyOf(((int[]) array)); |
532 | } |
533 | if (array.getClass() == long[].class) { |
534 | return copyOf(((long[]) array)); |
535 | } |
536 | if (array.getClass() == short[].class) { |
537 | return copyOf(((short[]) array)); |
538 | } |
539 | final int len = Array.getLength(array); |
540 | final Object copy = Array.newInstance(array.getClass().getComponentType(), len); |
541 | for (int i = (len- 1); (i >= 0); i--) { |
542 | Array.set(copy, i, copyOf(Array.get(array, i))); |
543 | } |
544 | return copy; |
545 | } |
546 | return null; |
547 | } |
548 | |
549 | /** |
550 | * Creates and returns a deep copy of a given array. |
551 | * |
552 | * @param array |
553 | * The array to copy or {@code null}. |
554 | * @return |
555 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
556 | */ |
557 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
558 | private static boolean[] copyOf(final boolean[] array) { |
559 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
560 | if (array!= null) { |
561 | final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
562 | System.arraycopy(array, 0, copy, 0, array.length); |
563 | return copy; |
564 | } |
565 | return null; |
566 | } |
567 | |
568 | /** |
569 | * Creates and returns a deep copy of a given array. |
570 | * |
571 | * @param array |
572 | * The array to copy or {@code null}. |
573 | * @return |
574 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
575 | */ |
576 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
577 | private static byte[] copyOf(final byte[] array) { |
578 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
579 | if (array!= null) { |
580 | final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
581 | System.arraycopy(array, 0, copy, 0, array.length); |
582 | return copy; |
583 | } |
584 | return null; |
585 | } |
586 | |
587 | /** |
588 | * Creates and returns a deep copy of a given array. |
589 | * |
590 | * @param array |
591 | * The array to copy or {@code null}. |
592 | * @return |
593 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
594 | */ |
595 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
596 | private static char[] copyOf(final char[] array) { |
597 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
598 | if (array!= null) { |
599 | final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
600 | System.arraycopy(array, 0, copy, 0, array.length); |
601 | return copy; |
602 | } |
603 | return null; |
604 | } |
605 | |
606 | /** |
607 | * Creates and returns a deep copy of a given array. |
608 | * |
609 | * @param array |
610 | * The array to copy or {@code null}. |
611 | * @return |
612 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
613 | */ |
614 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
615 | private static double[] copyOf(final double[] array) { |
616 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
617 | if (array!= null) { |
618 | final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
619 | System.arraycopy(array, 0, copy, 0, array.length); |
620 | return copy; |
621 | } |
622 | return null; |
623 | } |
624 | |
625 | /** |
626 | * Creates and returns a deep copy of a given array. |
627 | * |
628 | * @param array |
629 | * The array to copy or {@code null}. |
630 | * @return |
631 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
632 | */ |
633 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
634 | private static float[] copyOf(final float[] array) { |
635 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
636 | if (array!= null) { |
637 | final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
638 | System.arraycopy(array, 0, copy, 0, array.length); |
639 | return copy; |
640 | } |
641 | return null; |
642 | } |
643 | |
644 | /** |
645 | * Creates and returns a deep copy of a given array. |
646 | * |
647 | * @param array |
648 | * The array to copy or {@code null}. |
649 | * @return |
650 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
651 | */ |
652 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
653 | private static int[] copyOf(final int[] array) { |
654 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
655 | if (array!= null) { |
656 | final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
657 | System.arraycopy(array, 0, copy, 0, array.length); |
658 | return copy; |
659 | } |
660 | return null; |
661 | } |
662 | |
663 | /** |
664 | * Creates and returns a deep copy of a given array. |
665 | * |
666 | * @param array |
667 | * The array to copy or {@code null}. |
668 | * @return |
669 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
670 | */ |
671 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
672 | private static long[] copyOf(final long[] array) { |
673 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
674 | if (array!= null) { |
675 | final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
676 | System.arraycopy(array, 0, copy, 0, array.length); |
677 | return copy; |
678 | } |
679 | return null; |
680 | } |
681 | |
682 | /** |
683 | * Creates and returns a deep copy of a given array. |
684 | * |
685 | * @param array |
686 | * The array to copy or {@code null}. |
687 | * @return |
688 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
689 | */ |
690 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
691 | private static short[] copyOf(final short[] array) { |
692 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
693 | if (array!= null) { |
694 | final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
695 | System.arraycopy(array, 0, copy, 0, array.length); |
696 | return copy; |
697 | } |
698 | return null; |
699 | } |
700 | |
701 | /** |
702 | * Creates and returns a deep copy of a given {@code JAXBElement} instance. |
703 | * |
704 | * @param element |
705 | * The instance to copy or {@code null}. |
706 | * @return |
707 | * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. |
708 | */ |
709 | @SuppressWarnings("unchecked") |
710 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
711 | private static JAXBElement copyOf(final JAXBElement element) { |
712 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
713 | if (element!= null) { |
714 | final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); |
715 | copy.setNil(element.isNil()); |
716 | copy.setValue(copyOf(copy.getValue())); |
717 | return copy; |
718 | } |
719 | return null; |
720 | } |
721 | |
722 | /** |
723 | * Creates and returns a deep copy of a given {@code Serializable}. |
724 | * |
725 | * @param serializable |
726 | * The instance to copy or {@code null}. |
727 | * @return |
728 | * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}. |
729 | */ |
730 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
731 | private static Serializable copyOf(final Serializable serializable) { |
732 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
733 | if (serializable!= null) { |
734 | try { |
735 | final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream(); |
736 | final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput); |
737 | out.writeObject(serializable); |
738 | out.close(); |
739 | final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray()); |
740 | final ObjectInputStream in = new ObjectInputStream(byteArrayInput); |
741 | final Serializable copy = ((Serializable) in.readObject()); |
742 | in.close(); |
743 | return copy; |
744 | } catch (SecurityException e) { |
745 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
746 | } catch (ClassNotFoundException e) { |
747 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
748 | } catch (InvalidClassException e) { |
749 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
750 | } catch (NotSerializableException e) { |
751 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
752 | } catch (StreamCorruptedException e) { |
753 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
754 | } catch (OptionalDataException e) { |
755 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
756 | } catch (IOException e) { |
757 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
758 | } |
759 | } |
760 | return null; |
761 | } |
762 | |
763 | /** |
764 | * Creates and returns a deep copy of this object. |
765 | * |
766 | * |
767 | * @return |
768 | * A deep copy of this object. |
769 | */ |
770 | @Override |
771 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
772 | public Message clone() { |
773 | { |
774 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
775 | final Message clone = ((Message) super.clone()); |
776 | // CClassInfo: org.jomc.model.Texts |
777 | clone.template = ((this.template == null)?null:((this.getTemplate() == null)?null:this.getTemplate().clone())); |
778 | // CClassInfo: org.jomc.model.Arguments |
779 | clone.arguments = ((this.arguments == null)?null:((this.getArguments() == null)?null:this.getArguments().clone())); |
780 | // 'Any' collection. |
781 | if (this.any!= null) { |
782 | clone.any = null; |
783 | copyAny(this.getAny(), clone.getAny()); |
784 | } |
785 | // CBuiltinLeafInfo: java.lang.String |
786 | clone.name = ((this.name == null)?null:this.getName()); |
787 | // CBuiltinLeafInfo: java.lang.Boolean |
788 | clone._final = ((this._final == null)?null:this.isFinal()); |
789 | // CBuiltinLeafInfo: java.lang.Boolean |
790 | clone.override = ((this.override == null)?null:this.isOverride()); |
791 | return clone; |
792 | } |
793 | } |
794 | |
795 | /** |
796 | * System's line separator. |
797 | * @since 1.2 |
798 | */ |
799 | @javax.xml.bind.annotation.XmlTransient |
800 | private static final String LINE_SEPARATOR = System.getProperty( "line.separator", "\n" ); |
801 | |
802 | /** |
803 | * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the |
804 | * instance. |
805 | * |
806 | * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. |
807 | * @param localPart The local part of the {@code JAXBElement} to return. |
808 | * |
809 | * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property |
810 | * of the instance or {@code null}, if no such element is found. |
811 | * |
812 | * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}. |
813 | * @throws IllegalStateException if the {@code any} property contains more than one matching element. |
814 | * |
815 | * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String) |
816 | * |
817 | * @deprecated As of JOMC 1.1, please use method {@link #getAnyElement(java.lang.String, java.lang.String, java.lang.Class)}. |
818 | * This method will be removed in version 2.0. |
819 | */ |
820 | @Deprecated |
821 | public javax.xml.bind.JAXBElement getAnyElement( final String namespaceURI, final String localPart ) |
822 | { |
823 | return this.getAnyElement( this.getAny(), namespaceURI, localPart ); |
824 | } |
825 | |
826 | /** |
827 | * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any} |
828 | * property of the instance. |
829 | * |
830 | * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. |
831 | * @param localPart The local part of the {@code JAXBElement}s to return. |
832 | * |
833 | * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from |
834 | * the {@code any} property of the instance - an empty list if no such elements are found. |
835 | * |
836 | * @throws NullPointerException if {@code namespaceURI} or {@code localPart} is {@code null}. |
837 | * |
838 | * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String) |
839 | * |
840 | * @deprecated As of JOMC 1.1, please use method {@link #getAnyElements(java.lang.String, java.lang.String, java.lang.Class)}. |
841 | * This method will be removed in version 2.0. |
842 | */ |
843 | @Deprecated |
844 | public java.util.List<javax.xml.bind.JAXBElement> getAnyElements( final String namespaceURI, |
845 | final String localPart ) |
846 | { |
847 | return this.getAnyElements( this.getAny(), namespaceURI, localPart ); |
848 | } |
849 | |
850 | /** |
851 | * Gets a single {@code JAXBElement} matching a namespace URI and local part from the {@code any} property of the |
852 | * instance. |
853 | * |
854 | * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. |
855 | * @param localPart The local part of the {@code JAXBElement} to return. |
856 | * @param type The class of the type the element is bound to. |
857 | * @param <T> The type the element is bound to. |
858 | * |
859 | * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} property |
860 | * of the instance or {@code null}, if no such element is found. |
861 | * |
862 | * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}. |
863 | * @throws IllegalStateException if the {@code any} property contains more than one matching element. |
864 | * |
865 | * @see #getAnyElement(java.util.List, java.lang.String, java.lang.String, java.lang.Class) |
866 | * |
867 | * @since 1.1 |
868 | */ |
869 | public <T> javax.xml.bind.JAXBElement<T> getAnyElement( final String namespaceURI, final String localPart, |
870 | final Class<T> type ) |
871 | { |
872 | return this.getAnyElement( this.getAny(), namespaceURI, localPart, type ); |
873 | } |
874 | |
875 | /** |
876 | * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from the {@code any} |
877 | * property of the instance. |
878 | * |
879 | * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. |
880 | * @param localPart The local part of the {@code JAXBElement}s to return. |
881 | * @param type The class of the type the elements are bound to. |
882 | * @param <T> The type the elements are bound to. |
883 | * |
884 | * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from |
885 | * the {@code any} property of the instance - an empty list if no such elements are found. |
886 | * |
887 | * @throws NullPointerException if {@code namespaceURI}, {@code localPart} or {@code type} is {@code null}. |
888 | * |
889 | * @see #getAnyElements(java.util.List, java.lang.String, java.lang.String, java.lang.Class) |
890 | * |
891 | * @since 1.1 |
892 | */ |
893 | public <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final String namespaceURI, |
894 | final String localPart, |
895 | final Class<T> type ) |
896 | { |
897 | return this.getAnyElements( this.getAny(), namespaceURI, localPart, type ); |
898 | } |
899 | |
900 | /** |
901 | * Gets a single object matching a given class from the {@code any} property of the instance. |
902 | * |
903 | * @param clazz The class to return an instance of. |
904 | * @param <T> The type of the object to return. |
905 | * |
906 | * @return The instance of {@code clazz} from the {@code any} property of the instance or {@code null}, if no such |
907 | * instance is found. |
908 | * |
909 | * @throws NullPointerException if {@code clazz} is {@code null}. |
910 | * @throws IllegalStateException if the {@code any} property contains more than one matching object. |
911 | * |
912 | * @see #getAnyObject(java.util.List, java.lang.Class) |
913 | */ |
914 | public <T> T getAnyObject( final Class<T> clazz ) |
915 | { |
916 | return this.getAnyObject( this.getAny(), clazz ); |
917 | } |
918 | |
919 | /** |
920 | * Gets a list containing all objects matching a given class from the {@code any} property of the instance. |
921 | * |
922 | * @param clazz The class to return all instances of. |
923 | * @param <T> The type of the objects to return. |
924 | * |
925 | * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} property of the instance - |
926 | * an empty list if no such objects are found. |
927 | * |
928 | * @throws NullPointerException if {@code clazz} is {@code null}. |
929 | * |
930 | * @see #getAnyObjects(java.util.List, java.lang.Class) |
931 | */ |
932 | public <T> java.util.List<T> getAnyObjects( final Class<T> clazz ) |
933 | { |
934 | return this.getAnyObjects( this.getAny(), clazz ); |
935 | } |
936 | |
937 | /** |
938 | * Gets a Java {@code MessageFormat} instance for a given locale. |
939 | * |
940 | * @param locale The locale to get a Java {@code MessageFormat} instance for. |
941 | * |
942 | * @return A Java {@code MessageFormat} instance for {@code locale}. |
943 | * |
944 | * @throws NullPointerException if {@code locale} is {@code null}. |
945 | * @throws ModelObjectException if compiling the template of the message for {@code locale} to a |
946 | * {@code MessageFormat} fails. |
947 | * |
948 | * @see #getTemplate() |
949 | * |
950 | * @since 1.2 |
951 | */ |
952 | public java.text.MessageFormat getJavaMessage( final Locale locale ) throws ModelObjectException |
953 | { |
954 | if ( locale == null ) |
955 | { |
956 | throw new NullPointerException( "locale" ); |
957 | } |
958 | |
959 | final Text text = this.getTemplate().getText( locale.getLanguage().toLowerCase( Locale.ENGLISH ) ); |
960 | final StringBuilder builder = new StringBuilder( text.getValue().length() ); |
961 | String pattern = null; |
962 | |
963 | try |
964 | { |
965 | final java.io.BufferedReader reader = |
966 | new java.io.BufferedReader( new java.io.StringReader( text.getValue() ) ); |
967 | |
968 | String line; |
969 | while ( ( line = reader.readLine() ) != null ) |
970 | { |
971 | builder.append( LINE_SEPARATOR ).append( line ); |
972 | } |
973 | |
974 | pattern = builder.length() > 0 ? builder.substring( LINE_SEPARATOR.length() ) : builder.toString(); |
975 | return new java.text.MessageFormat( pattern, locale ); |
976 | |
977 | } |
978 | catch ( final IllegalArgumentException e ) |
979 | { |
980 | throw new ModelObjectException( getMessage( "javaMessageParseException", pattern, getMessage( e ) ), e ); |
981 | } |
982 | catch ( final java.io.IOException e ) |
983 | { |
984 | throw new AssertionError( e ); |
985 | } |
986 | } |
987 | |
988 | /** |
989 | * Gets the Java getter method name of the message. |
990 | * |
991 | * @return The Java getter method name of the message. |
992 | * |
993 | * @throws ModelObjectException if compiling the name of the message to a {@code JavaIdentifier} fails. |
994 | * |
995 | * @since 1.4 |
996 | * |
997 | * @see #getName() |
998 | */ |
999 | public JavaIdentifier getJavaGetterMethodName() throws ModelObjectException |
1000 | { |
1001 | try |
1002 | { |
1003 | return JavaIdentifier.parse( "get" + JavaIdentifier.normalize( |
1004 | this.getName() != null ? this.getName() : "", JavaIdentifier.NormalizationMode.CAMEL_CASE ) ); |
1005 | |
1006 | } |
1007 | catch ( final java.text.ParseException e ) |
1008 | { |
1009 | throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(), |
1010 | getMessage( e ) ), e ); |
1011 | |
1012 | } |
1013 | } |
1014 | |
1015 | /** |
1016 | * Gets the Java setter method name of the message. |
1017 | * |
1018 | * @return The Java setter method name of the message. |
1019 | * |
1020 | * @throws ModelObjectException if compiling the name of the message to a {@code JavaIdentifier} fails. |
1021 | * |
1022 | * @since 1.4 |
1023 | * |
1024 | * @see #getName() |
1025 | */ |
1026 | public JavaIdentifier getJavaSetterMethodName() throws ModelObjectException |
1027 | { |
1028 | try |
1029 | { |
1030 | return JavaIdentifier.parse( "set" + JavaIdentifier.normalize( |
1031 | this.getName() != null ? this.getName() : "", JavaIdentifier.NormalizationMode.CAMEL_CASE ) ); |
1032 | |
1033 | } |
1034 | catch ( final java.text.ParseException e ) |
1035 | { |
1036 | throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(), |
1037 | getMessage( e ) ), e ); |
1038 | |
1039 | } |
1040 | } |
1041 | |
1042 | /** |
1043 | * Gets the Java variable name of the message. |
1044 | * |
1045 | * @return The Java variable name of the message. |
1046 | * |
1047 | * @throws ModelObjectException if compiling the name of the message to a {@code JavaIdentifier} fails. |
1048 | * |
1049 | * @since 1.4 |
1050 | * |
1051 | * @see #getName() |
1052 | */ |
1053 | public JavaIdentifier getJavaVariableName() throws ModelObjectException |
1054 | { |
1055 | try |
1056 | { |
1057 | return JavaIdentifier.normalize( this.getName() != null ? this.getName() : "", |
1058 | JavaIdentifier.NormalizationMode.VARIABLE_NAME_CONVENTION ); |
1059 | |
1060 | } |
1061 | catch ( final java.text.ParseException e ) |
1062 | { |
1063 | throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(), |
1064 | getMessage( e ) ), e ); |
1065 | |
1066 | } |
1067 | } |
1068 | |
1069 | /** |
1070 | * Gets the Java constant name of the message. |
1071 | * |
1072 | * @return The Java constant name of the message. |
1073 | * |
1074 | * @throws ModelObjectException if compiling the name of the message to a {@code JavaIdentifier} fails. |
1075 | * |
1076 | * @since 1.4 |
1077 | * |
1078 | * @see #getName() |
1079 | */ |
1080 | public JavaIdentifier getJavaConstantName() throws ModelObjectException |
1081 | { |
1082 | try |
1083 | { |
1084 | return JavaIdentifier.normalize( this.getName() != null ? this.getName() : "", |
1085 | JavaIdentifier.NormalizationMode.CONSTANT_NAME_CONVENTION ); |
1086 | |
1087 | } |
1088 | catch ( final java.text.ParseException e ) |
1089 | { |
1090 | throw new ModelObjectException( getMessage( "javaIdentifierParseException", this.getName(), |
1091 | getMessage( e ) ), e ); |
1092 | |
1093 | } |
1094 | } |
1095 | |
1096 | private static String getMessage( final Throwable t ) |
1097 | { |
1098 | return t != null |
1099 | ? t.getMessage() != null && t.getMessage().trim().length() > 0 |
1100 | ? t.getMessage() |
1101 | : getMessage( t.getCause() ) |
1102 | : null; |
1103 | |
1104 | } |
1105 | |
1106 | private static String getMessage( final String key, final Object... arguments ) |
1107 | { |
1108 | return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( |
1109 | Message.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ). |
1110 | getString( key ), arguments ); |
1111 | |
1112 | } |
1113 | |
1114 | } |