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.02.03 at 01:25:12 AM UTC |
6 | // |
7 | |
8 | |
9 | package org.jomc.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.ArrayList; |
26 | import java.util.Calendar; |
27 | import java.util.Currency; |
28 | import java.util.Date; |
29 | import java.util.Iterator; |
30 | import java.util.List; |
31 | import java.util.Locale; |
32 | import java.util.TimeZone; |
33 | import java.util.UUID; |
34 | import javax.annotation.Generated; |
35 | import javax.xml.bind.JAXBElement; |
36 | import javax.xml.bind.annotation.XmlAccessType; |
37 | import javax.xml.bind.annotation.XmlAccessorType; |
38 | import javax.xml.bind.annotation.XmlAnyElement; |
39 | import javax.xml.bind.annotation.XmlAttribute; |
40 | import javax.xml.bind.annotation.XmlSeeAlso; |
41 | import javax.xml.bind.annotation.XmlType; |
42 | import javax.xml.datatype.Duration; |
43 | import javax.xml.datatype.XMLGregorianCalendar; |
44 | import javax.xml.namespace.QName; |
45 | import org.w3c.dom.Element; |
46 | |
47 | |
48 | /** |
49 | * |
50 | * Model of a person. |
51 | * |
52 | * The 'Person' type defines attributes 'name' and 'mail'. Attribute 'name' holds the name of a person. Attribute 'mail' |
53 | * holds the mail address of a person. |
54 | * |
55 | * |
56 | * <p>Java class for Person complex type. |
57 | * |
58 | * <p>The following schema fragment specifies the expected content contained within this class. |
59 | * |
60 | * <pre> |
61 | * <complexType name="Person"> |
62 | * <complexContent> |
63 | * <extension base="{http://jomc.org/model}ModelObject"> |
64 | * <sequence> |
65 | * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> |
66 | * </sequence> |
67 | * <attribute name="name" use="required" type="{http://jomc.org/model}String" /> |
68 | * <attribute name="mail" type="{http://jomc.org/model}String" /> |
69 | * </extension> |
70 | * </complexContent> |
71 | * </complexType> |
72 | * </pre> |
73 | * |
74 | * |
75 | */ |
76 | @XmlAccessorType(XmlAccessType.FIELD) |
77 | @XmlType(name = "Person", propOrder = { |
78 | "any" |
79 | }) |
80 | @XmlSeeAlso({ |
81 | Author.class |
82 | }) |
83 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
84 | public class Person |
85 | extends ModelObject |
86 | implements Cloneable |
87 | { |
88 | |
89 | @XmlAnyElement(lax = true) |
90 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
91 | protected List<Object> any; |
92 | @XmlAttribute(required = true) |
93 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
94 | protected String name; |
95 | @XmlAttribute |
96 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
97 | protected String mail; |
98 | |
99 | /** |
100 | * Creates a new {@code Person} instance. |
101 | * |
102 | */ |
103 | public Person() { |
104 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
105 | super(); |
106 | } |
107 | |
108 | /** |
109 | * Creates a new {@code Person} instance by deeply copying a given {@code Person} instance. |
110 | * |
111 | * |
112 | * @param o |
113 | * The instance to copy. |
114 | * @throws NullPointerException |
115 | * if {@code o} is {@code null}. |
116 | */ |
117 | public Person(final Person o) { |
118 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
119 | super(o); |
120 | if (o == null) { |
121 | throw new NullPointerException("Cannot create a copy of 'Person' from 'null'."); |
122 | } |
123 | // 'Any' collection. |
124 | copyAny(o.getAny(), getAny()); |
125 | // CBuiltinLeafInfo: java.lang.String |
126 | this.name = o.getName(); |
127 | // CBuiltinLeafInfo: java.lang.String |
128 | this.mail = o.getMail(); |
129 | } |
130 | |
131 | /** |
132 | * Gets the value of the any property. |
133 | * |
134 | * <p> |
135 | * This accessor method returns a reference to the live list, |
136 | * not a snapshot. Therefore any modification you make to the |
137 | * returned list will be present inside the JAXB object. |
138 | * This is why there is not a <CODE>set</CODE> method for the any property. |
139 | * |
140 | * <p> |
141 | * For example, to add a new item, do as follows: |
142 | * <pre> |
143 | * getAny().add(newItem); |
144 | * </pre> |
145 | * |
146 | * |
147 | * <p> |
148 | * Objects of the following type(s) are allowed in the list |
149 | * {@link Element } |
150 | * {@link Object } |
151 | * |
152 | * |
153 | */ |
154 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
155 | public List<Object> getAny() { |
156 | if (any == null) { |
157 | any = new ArrayList<Object>(); |
158 | } |
159 | return this.any; |
160 | } |
161 | |
162 | /** |
163 | * Name of this person. |
164 | * |
165 | * @return |
166 | * possible object is |
167 | * {@link String } |
168 | * |
169 | */ |
170 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
171 | public String getName() { |
172 | return name; |
173 | } |
174 | |
175 | /** |
176 | * Sets the value of the name property. |
177 | * |
178 | * @param value |
179 | * allowed object is |
180 | * {@link String } |
181 | * |
182 | */ |
183 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
184 | public void setName(String value) { |
185 | this.name = value; |
186 | } |
187 | |
188 | /** |
189 | * Mail address of this person or {@code null}. |
190 | * |
191 | * @return |
192 | * possible object is |
193 | * {@link String } |
194 | * |
195 | */ |
196 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
197 | public String getMail() { |
198 | return mail; |
199 | } |
200 | |
201 | /** |
202 | * Sets the value of the mail property. |
203 | * |
204 | * @param value |
205 | * allowed object is |
206 | * {@link String } |
207 | * |
208 | */ |
209 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
210 | public void setMail(String value) { |
211 | this.mail = value; |
212 | } |
213 | |
214 | /** |
215 | * Copies all values of property {@code Any} deeply. |
216 | * |
217 | * @param target |
218 | * The target to copy {@code source} to. |
219 | * @param source |
220 | * The source to copy from. |
221 | * @throws NullPointerException |
222 | * if {@code source} or {@code target} is {@code null}. |
223 | */ |
224 | @SuppressWarnings("unchecked") |
225 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
226 | private static void copyAny(final List<Object> source, final List<Object> target) { |
227 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
228 | if (!source.isEmpty()) { |
229 | for (Iterator it = source.iterator(); it.hasNext(); ) { |
230 | final Object next = it.next(); |
231 | if (next instanceof Element) { |
232 | // CWildcardTypeInfo: org.w3c.dom.Element |
233 | target.add(((Element)((Element) next).cloneNode(true))); |
234 | continue; |
235 | } |
236 | if (next instanceof Object) { |
237 | // CBuiltinLeafInfo: java.lang.Object |
238 | target.add(copyOfObject(((Object) next))); |
239 | continue; |
240 | } |
241 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
242 | throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Any' of class 'org.jomc.model.Person'.")); |
243 | } |
244 | } |
245 | } |
246 | |
247 | /** |
248 | * Creates and returns a deep copy of a given object. |
249 | * |
250 | * @param o |
251 | * The instance to copy or {@code null}. |
252 | * @return |
253 | * A deep copy of {@code o} or {@code null} if {@code o} is {@code null}. |
254 | */ |
255 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
256 | private static Object copyOfObject(final Object o) { |
257 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
258 | if (o!= null) { |
259 | if (o.getClass().isPrimitive()) { |
260 | return o; |
261 | } |
262 | if (o.getClass().isArray()) { |
263 | return copyOfArray(o); |
264 | } |
265 | if (o instanceof Boolean) { |
266 | return o; |
267 | } |
268 | if (o instanceof Byte) { |
269 | return o; |
270 | } |
271 | if (o instanceof Character) { |
272 | return o; |
273 | } |
274 | if (o instanceof Double) { |
275 | return o; |
276 | } |
277 | if (o instanceof Enum) { |
278 | return o; |
279 | } |
280 | if (o instanceof Float) { |
281 | return o; |
282 | } |
283 | if (o instanceof Integer) { |
284 | return o; |
285 | } |
286 | if (o instanceof Long) { |
287 | return o; |
288 | } |
289 | if (o instanceof Short) { |
290 | return o; |
291 | } |
292 | if (o instanceof String) { |
293 | return o; |
294 | } |
295 | if (o instanceof BigDecimal) { |
296 | return o; |
297 | } |
298 | if (o instanceof BigInteger) { |
299 | return o; |
300 | } |
301 | if (o instanceof UUID) { |
302 | return o; |
303 | } |
304 | if (o instanceof QName) { |
305 | return o; |
306 | } |
307 | if (o instanceof Duration) { |
308 | return o; |
309 | } |
310 | if (o instanceof Currency) { |
311 | return o; |
312 | } |
313 | if (o instanceof XMLGregorianCalendar) { |
314 | return ((XMLGregorianCalendar) o).clone(); |
315 | } |
316 | if (o instanceof Date) { |
317 | return ((Date) o).clone(); |
318 | } |
319 | if (o instanceof Calendar) { |
320 | return ((Calendar) o).clone(); |
321 | } |
322 | if (o instanceof TimeZone) { |
323 | return ((TimeZone) o).clone(); |
324 | } |
325 | if (o instanceof Locale) { |
326 | return ((Locale) o).clone(); |
327 | } |
328 | if (o instanceof Element) { |
329 | return ((Element)((Element) o).cloneNode(true)); |
330 | } |
331 | if (o instanceof JAXBElement) { |
332 | return copyOFJAXBElement(((JAXBElement) o)); |
333 | } |
334 | try { |
335 | return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null)); |
336 | } catch (NoSuchMethodException e) { |
337 | if (o instanceof Serializable) { |
338 | return copyOfSerializable(((Serializable) o)); |
339 | } |
340 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
341 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
342 | } catch (IllegalAccessException e) { |
343 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
344 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
345 | } catch (InvocationTargetException e) { |
346 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
347 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
348 | } catch (SecurityException e) { |
349 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
350 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e)); |
351 | } catch (IllegalArgumentException e) { |
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 (ExceptionInInitializerError 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 | } |
358 | } |
359 | return null; |
360 | } |
361 | |
362 | /** |
363 | * Creates and returns a deep copy of a given array. |
364 | * |
365 | * @param array |
366 | * The array to copy or {@code null}. |
367 | * @return |
368 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
369 | */ |
370 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
371 | private static Object copyOfArray(final Object array) { |
372 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
373 | if (array!= null) { |
374 | if (array.getClass() == boolean[].class) { |
375 | return copyOf(((boolean[]) array)); |
376 | } |
377 | if (array.getClass() == byte[].class) { |
378 | return copyOf(((byte[]) array)); |
379 | } |
380 | if (array.getClass() == char[].class) { |
381 | return copyOf(((char[]) array)); |
382 | } |
383 | if (array.getClass() == double[].class) { |
384 | return copyOf(((double[]) array)); |
385 | } |
386 | if (array.getClass() == float[].class) { |
387 | return copyOf(((float[]) array)); |
388 | } |
389 | if (array.getClass() == int[].class) { |
390 | return copyOf(((int[]) array)); |
391 | } |
392 | if (array.getClass() == long[].class) { |
393 | return copyOf(((long[]) array)); |
394 | } |
395 | if (array.getClass() == short[].class) { |
396 | return copyOf(((short[]) array)); |
397 | } |
398 | final int len = Array.getLength(array); |
399 | final Object copy = Array.newInstance(array.getClass().getComponentType(), len); |
400 | for (int i = (len- 1); (i >= 0); i--) { |
401 | Array.set(copy, i, copyOfObject(Array.get(array, i))); |
402 | } |
403 | return copy; |
404 | } |
405 | return null; |
406 | } |
407 | |
408 | /** |
409 | * Creates and returns a deep copy of a given array. |
410 | * |
411 | * @param array |
412 | * The array to copy or {@code null}. |
413 | * @return |
414 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
415 | */ |
416 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
417 | private static boolean[] copyOf(final boolean[] array) { |
418 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
419 | if (array!= null) { |
420 | final boolean[] copy = ((boolean[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
421 | System.arraycopy(array, 0, copy, 0, array.length); |
422 | return copy; |
423 | } |
424 | return null; |
425 | } |
426 | |
427 | /** |
428 | * Creates and returns a deep copy of a given array. |
429 | * |
430 | * @param array |
431 | * The array to copy or {@code null}. |
432 | * @return |
433 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
434 | */ |
435 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
436 | private static byte[] copyOf(final byte[] array) { |
437 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
438 | if (array!= null) { |
439 | final byte[] copy = ((byte[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
440 | System.arraycopy(array, 0, copy, 0, array.length); |
441 | return copy; |
442 | } |
443 | return null; |
444 | } |
445 | |
446 | /** |
447 | * Creates and returns a deep copy of a given array. |
448 | * |
449 | * @param array |
450 | * The array to copy or {@code null}. |
451 | * @return |
452 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
453 | */ |
454 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
455 | private static char[] copyOf(final char[] array) { |
456 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
457 | if (array!= null) { |
458 | final char[] copy = ((char[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
459 | System.arraycopy(array, 0, copy, 0, array.length); |
460 | return copy; |
461 | } |
462 | return null; |
463 | } |
464 | |
465 | /** |
466 | * Creates and returns a deep copy of a given array. |
467 | * |
468 | * @param array |
469 | * The array to copy or {@code null}. |
470 | * @return |
471 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
472 | */ |
473 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
474 | private static double[] copyOf(final double[] array) { |
475 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
476 | if (array!= null) { |
477 | final double[] copy = ((double[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
478 | System.arraycopy(array, 0, copy, 0, array.length); |
479 | return copy; |
480 | } |
481 | return null; |
482 | } |
483 | |
484 | /** |
485 | * Creates and returns a deep copy of a given array. |
486 | * |
487 | * @param array |
488 | * The array to copy or {@code null}. |
489 | * @return |
490 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
491 | */ |
492 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
493 | private static float[] copyOf(final float[] array) { |
494 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
495 | if (array!= null) { |
496 | final float[] copy = ((float[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
497 | System.arraycopy(array, 0, copy, 0, array.length); |
498 | return copy; |
499 | } |
500 | return null; |
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 = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
512 | private static int[] copyOf(final int[] array) { |
513 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
514 | if (array!= null) { |
515 | final int[] copy = ((int[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
516 | System.arraycopy(array, 0, copy, 0, array.length); |
517 | return copy; |
518 | } |
519 | return null; |
520 | } |
521 | |
522 | /** |
523 | * Creates and returns a deep copy of a given array. |
524 | * |
525 | * @param array |
526 | * The array to copy or {@code null}. |
527 | * @return |
528 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
529 | */ |
530 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
531 | private static long[] copyOf(final long[] array) { |
532 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
533 | if (array!= null) { |
534 | final long[] copy = ((long[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
535 | System.arraycopy(array, 0, copy, 0, array.length); |
536 | return copy; |
537 | } |
538 | return null; |
539 | } |
540 | |
541 | /** |
542 | * Creates and returns a deep copy of a given array. |
543 | * |
544 | * @param array |
545 | * The array to copy or {@code null}. |
546 | * @return |
547 | * A deep copy of {@code array} or {@code null} if {@code array} is {@code null}. |
548 | */ |
549 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
550 | private static short[] copyOf(final short[] array) { |
551 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
552 | if (array!= null) { |
553 | final short[] copy = ((short[]) Array.newInstance(array.getClass().getComponentType(), array.length)); |
554 | System.arraycopy(array, 0, copy, 0, array.length); |
555 | return copy; |
556 | } |
557 | return null; |
558 | } |
559 | |
560 | /** |
561 | * Creates and returns a deep copy of a given {@code JAXBElement} instance. |
562 | * |
563 | * @param element |
564 | * The instance to copy or {@code null}. |
565 | * @return |
566 | * A deep copy of {@code element} or {@code null} if {@code element} is {@code null}. |
567 | */ |
568 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
569 | private static JAXBElement copyOFJAXBElement(final JAXBElement element) { |
570 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
571 | if (element!= null) { |
572 | final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue()); |
573 | copy.setNil(element.isNil()); |
574 | copy.setValue(copyOfObject(copy.getValue())); |
575 | return copy; |
576 | } |
577 | return null; |
578 | } |
579 | |
580 | /** |
581 | * Creates and returns a deep copy of a given {@code Serializable}. |
582 | * |
583 | * @param serializable |
584 | * The instance to copy or {@code null}. |
585 | * @return |
586 | * A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}. |
587 | */ |
588 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
589 | private static Serializable copyOfSerializable(final Serializable serializable) { |
590 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
591 | if (serializable!= null) { |
592 | try { |
593 | final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream(); |
594 | final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput); |
595 | out.writeObject(serializable); |
596 | out.close(); |
597 | final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray()); |
598 | final ObjectInputStream in = new ObjectInputStream(byteArrayInput); |
599 | final Serializable copy = ((Serializable) in.readObject()); |
600 | in.close(); |
601 | return copy; |
602 | } catch (SecurityException e) { |
603 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
604 | } catch (ClassNotFoundException e) { |
605 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
606 | } catch (InvalidClassException e) { |
607 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
608 | } catch (NotSerializableException e) { |
609 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
610 | } catch (StreamCorruptedException e) { |
611 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
612 | } catch (OptionalDataException e) { |
613 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
614 | } catch (IOException e) { |
615 | throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e)); |
616 | } |
617 | } |
618 | return null; |
619 | } |
620 | |
621 | /** |
622 | * Creates and returns a deep copy of this object. |
623 | * |
624 | * |
625 | * @return |
626 | * A deep copy of this object. |
627 | */ |
628 | @Override |
629 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
630 | public Person clone() { |
631 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
632 | return new Person(this); |
633 | } |
634 | |
635 | } |