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