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: 2013.04.22 at 06:59:56 AM CEST |
6 | // |
7 | |
8 | |
9 | package org.jomc.tools.model; |
10 | |
11 | import javax.annotation.Generated; |
12 | import javax.xml.bind.annotation.XmlAccessType; |
13 | import javax.xml.bind.annotation.XmlAccessorType; |
14 | import javax.xml.bind.annotation.XmlAttribute; |
15 | import javax.xml.bind.annotation.XmlSeeAlso; |
16 | import javax.xml.bind.annotation.XmlType; |
17 | |
18 | |
19 | /** |
20 | * Base tools type. |
21 | * |
22 | * <p>Java class for ToolsType complex type. |
23 | * |
24 | * <p>The following schema fragment specifies the expected content contained within this class. |
25 | * |
26 | * <pre> |
27 | * <complexType name="ToolsType"> |
28 | * <complexContent> |
29 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
30 | * <attribute name="modelVersion" type="{http://www.w3.org/2001/XMLSchema}string" default="1.2" /> |
31 | * </restriction> |
32 | * </complexContent> |
33 | * </complexType> |
34 | * </pre> |
35 | * |
36 | * |
37 | */ |
38 | @XmlAccessorType(XmlAccessType.FIELD) |
39 | @XmlType(name = "ToolsType", namespace = "http://jomc.org/tools/model") |
40 | @XmlSeeAlso({ |
41 | SourceSectionType.class, |
42 | SourceSectionsType.class, |
43 | SourceFileType.class, |
44 | SourceFilesType.class |
45 | }) |
46 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-22T06:59:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
47 | public class ToolsType implements Cloneable |
48 | { |
49 | |
50 | @XmlAttribute(name = "modelVersion") |
51 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-22T06:59:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
52 | protected String modelVersion; |
53 | |
54 | /** |
55 | * Creates a new {@code ToolsType} instance. |
56 | * |
57 | */ |
58 | public ToolsType() { |
59 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
60 | super(); |
61 | } |
62 | |
63 | /** |
64 | * Creates a new {@code ToolsType} instance by deeply copying a given {@code ToolsType} instance. |
65 | * |
66 | * |
67 | * @param o |
68 | * The instance to copy. |
69 | * @throws NullPointerException |
70 | * if {@code o} is {@code null}. |
71 | */ |
72 | public ToolsType(final ToolsType o) { |
73 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
74 | super(); |
75 | if (o == null) { |
76 | throw new NullPointerException("Cannot create a copy of 'ToolsType' from 'null'."); |
77 | } |
78 | // CBuiltinLeafInfo: java.lang.String |
79 | this.modelVersion = ((o.modelVersion == null)?null:o.getModelVersion()); |
80 | } |
81 | |
82 | /** |
83 | * Gets the value of the modelVersion property. |
84 | * |
85 | * @return |
86 | * possible object is |
87 | * {@link String } |
88 | * |
89 | */ |
90 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-22T06:59:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
91 | public String getModelVersion() { |
92 | if (modelVersion == null) { |
93 | return "1.2"; |
94 | } else { |
95 | return modelVersion; |
96 | } |
97 | } |
98 | |
99 | /** |
100 | * Sets the value of the modelVersion property. |
101 | * |
102 | * @param value |
103 | * allowed object is |
104 | * {@link String } |
105 | * |
106 | */ |
107 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-22T06:59:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
108 | public void setModelVersion(String value) { |
109 | this.modelVersion = value; |
110 | } |
111 | |
112 | /** |
113 | * Creates and returns a deep copy of this object. |
114 | * |
115 | * |
116 | * @return |
117 | * A deep copy of this object. |
118 | */ |
119 | @Override |
120 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-04-22T06:59:56+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
121 | public ToolsType clone() { |
122 | try { |
123 | { |
124 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
125 | final ToolsType clone = ((ToolsType) super.clone()); |
126 | // CBuiltinLeafInfo: java.lang.String |
127 | clone.modelVersion = ((this.modelVersion == null)?null:this.getModelVersion()); |
128 | return clone; |
129 | } |
130 | } catch (CloneNotSupportedException e) { |
131 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
132 | throw new AssertionError(e); |
133 | } |
134 | } |
135 | |
136 | /** |
137 | * Gets a single {@code JAXBElement} matching a namespace URI and local part from a given list of objects. |
138 | * |
139 | * @param any The list to search. |
140 | * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. |
141 | * @param localPart The local part of the {@code JAXBElement} to return. |
142 | * @param type The class of the type the element is bound to. |
143 | * @param <T> The type the element is bound to. |
144 | * |
145 | * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} list or |
146 | * {@code null} if no such element is found. |
147 | * |
148 | * @throws NullPointerException if {@code any}, {@code namespaceURI}, {@code localPart} or {@code type} is |
149 | * {@code null}. |
150 | * @throws IllegalStateException if {@code any} contains more than one matching element. |
151 | */ |
152 | protected <T> javax.xml.bind.JAXBElement<T> getAnyElement( final java.util.List<Object> any, |
153 | final String namespaceURI, |
154 | final String localPart, |
155 | final Class<T> type ) |
156 | { |
157 | if ( any == null ) |
158 | { |
159 | throw new NullPointerException( "any" ); |
160 | } |
161 | if ( namespaceURI == null ) |
162 | { |
163 | throw new NullPointerException( "namespaceURI" ); |
164 | } |
165 | if ( localPart == null ) |
166 | { |
167 | throw new NullPointerException( "localPart" ); |
168 | } |
169 | if ( type == null ) |
170 | { |
171 | throw new NullPointerException( "type" ); |
172 | } |
173 | |
174 | javax.xml.bind.JAXBElement<?> anyElement = null; |
175 | |
176 | for ( int i = 0, s0 = any.size(); i < s0; i++ ) |
177 | { |
178 | final Object o = any.get( i ); |
179 | |
180 | if ( o instanceof javax.xml.bind.JAXBElement<?> ) |
181 | { |
182 | final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o; |
183 | |
184 | if ( namespaceURI.equals( e.getName().getNamespaceURI() ) |
185 | && localPart.equals( e.getName().getLocalPart() ) ) |
186 | { |
187 | if ( anyElement == null ) |
188 | { |
189 | anyElement = e; |
190 | } |
191 | else |
192 | { |
193 | throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(), |
194 | namespaceURI, localPart ) ); |
195 | |
196 | } |
197 | } |
198 | } |
199 | } |
200 | |
201 | if ( anyElement != null && anyElement.getValue() != null && anyElement.getValue().getClass().equals( type ) ) |
202 | { |
203 | @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> e = |
204 | (javax.xml.bind.JAXBElement<T>) anyElement; |
205 | |
206 | return e; |
207 | } |
208 | |
209 | return null; |
210 | } |
211 | |
212 | /** |
213 | * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from a given list of |
214 | * objects. |
215 | * |
216 | * @param any The list to search. |
217 | * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. |
218 | * @param localPart The local part of the {@code JAXBElement}s to return. |
219 | * @param type The class of the type the elements are bound to. |
220 | * @param <T> The type the elements are bound to. |
221 | * |
222 | * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from |
223 | * the {@code any} list - an empty list if no such elements are found. |
224 | * |
225 | * @throws NullPointerException if {@code any}, {@code namespaceURI}, {@code localPart} or {@code type} is |
226 | * {@code null}. |
227 | */ |
228 | protected <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final java.util.List<Object> any, |
229 | final String namespaceURI, |
230 | final String localPart, |
231 | final Class<T> type ) |
232 | { |
233 | if ( any == null ) |
234 | { |
235 | throw new NullPointerException( "any" ); |
236 | } |
237 | if ( namespaceURI == null ) |
238 | { |
239 | throw new NullPointerException( "namespaceURI" ); |
240 | } |
241 | if ( localPart == null ) |
242 | { |
243 | throw new NullPointerException( "localPart" ); |
244 | } |
245 | if ( type == null ) |
246 | { |
247 | throw new NullPointerException( "type" ); |
248 | } |
249 | |
250 | final java.util.List<javax.xml.bind.JAXBElement<T>> anyElements = |
251 | new java.util.ArrayList<javax.xml.bind.JAXBElement<T>>( any.size() ); |
252 | |
253 | for ( int i = 0, s0 = any.size(); i < s0; i++ ) |
254 | { |
255 | final Object o = any.get( i ); |
256 | |
257 | if ( o instanceof javax.xml.bind.JAXBElement<?> ) |
258 | { |
259 | final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o; |
260 | |
261 | if ( namespaceURI.equals( e.getName().getNamespaceURI() ) |
262 | && localPart.equals( e.getName().getLocalPart() ) |
263 | && e.getValue() != null && e.getValue().getClass().equals( type ) ) |
264 | { |
265 | @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> anyElement = |
266 | (javax.xml.bind.JAXBElement<T>) e; |
267 | |
268 | anyElements.add( anyElement ); |
269 | } |
270 | } |
271 | } |
272 | |
273 | return java.util.Collections.unmodifiableList( anyElements ); |
274 | } |
275 | |
276 | /** |
277 | * Gets a single object matching a class from a given list of objects. |
278 | * |
279 | * @param any The list to search. |
280 | * @param clazz The class to return an instance of. |
281 | * @param <T> The type of the object to return. |
282 | * |
283 | * @return The instance of {@code clazz} from the {@code any} list or {@code null}, if no such instance is found. |
284 | * |
285 | * @throws NullPointerException if {@code any} or {@code clazz} is {@code null}. |
286 | * @throws IllegalStateException if {@code any} contains more than one matching object. |
287 | */ |
288 | protected <T> T getAnyObject( final java.util.List<Object> any, final Class<T> clazz ) |
289 | { |
290 | if ( any == null ) |
291 | { |
292 | throw new NullPointerException( "any" ); |
293 | } |
294 | if ( clazz == null ) |
295 | { |
296 | throw new NullPointerException( "clazz" ); |
297 | } |
298 | |
299 | T anyObject = null; |
300 | |
301 | for ( int i = 0, s0 = any.size(); i < s0; i++ ) |
302 | { |
303 | Object o = any.get( i ); |
304 | |
305 | if ( o instanceof javax.xml.bind.JAXBElement<?> ) |
306 | { |
307 | o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue(); |
308 | } |
309 | |
310 | if ( clazz.equals( o.getClass() ) ) |
311 | { |
312 | if ( anyObject == null ) |
313 | { |
314 | @SuppressWarnings( "unchecked" ) final T object = (T) o; |
315 | anyObject = object; |
316 | } |
317 | else |
318 | { |
319 | throw new IllegalStateException( getMessage( "nonUniqueObject", this.getClass().getName(), |
320 | clazz.getName() ) ); |
321 | |
322 | } |
323 | } |
324 | } |
325 | |
326 | return anyObject; |
327 | } |
328 | |
329 | /** |
330 | * Gets a list containing all objects matching a class from a given list of objects. |
331 | * |
332 | * @param any The list to search. |
333 | * @param clazz The class to return all instances of. |
334 | * @param <T> The type of the objects to return. |
335 | * |
336 | * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} list - an empty list if no |
337 | * such objects are found. |
338 | * |
339 | * @throws NullPointerException if {@code any} or {@code clazz} is {@code null}. |
340 | */ |
341 | protected <T> java.util.List<T> getAnyObjects( final java.util.List<Object> any, final Class<T> clazz ) |
342 | { |
343 | if ( any == null ) |
344 | { |
345 | throw new NullPointerException( "any" ); |
346 | } |
347 | if ( clazz == null ) |
348 | { |
349 | throw new NullPointerException( "namespaceURI" ); |
350 | } |
351 | |
352 | final java.util.List<T> anyElements = new java.util.ArrayList<T>( any.size() ); |
353 | |
354 | for ( int i = 0, s0 = any.size(); i < s0; i++ ) |
355 | { |
356 | Object o = any.get( i ); |
357 | |
358 | if ( o instanceof javax.xml.bind.JAXBElement<?> ) |
359 | { |
360 | o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue(); |
361 | } |
362 | |
363 | if ( clazz.equals( o.getClass() ) ) |
364 | { |
365 | @SuppressWarnings( "unchecked" ) final T object = (T) o; |
366 | anyElements.add( object ); |
367 | } |
368 | } |
369 | |
370 | return java.util.Collections.unmodifiableList( anyElements ); |
371 | } |
372 | |
373 | private static String getMessage( final String key, final Object... args ) |
374 | { |
375 | return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( |
376 | ToolsType.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ). |
377 | getString( key ), args ); |
378 | } |
379 | |
380 | } |