1
2
3
4
5
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 TemplateParameterType.class
46 })
47 @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
48 public class ToolsType implements Cloneable
49 {
50
51 @XmlAttribute(name = "modelVersion")
52 @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
53 protected String modelVersion;
54
55
56
57
58
59 public ToolsType() {
60
61 super();
62 }
63
64
65
66
67
68
69
70
71
72
73 public ToolsType(final ToolsType o) {
74
75 super();
76 if (o == null) {
77 throw new NullPointerException("Cannot create a copy of 'ToolsType' from 'null'.");
78 }
79
80 this.modelVersion = ((o.modelVersion == null)?null:o.getModelVersion());
81 }
82
83
84
85
86
87
88
89
90
91 @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
92 public String getModelVersion() {
93 if (modelVersion == null) {
94 return "1.6";
95 } else {
96 return modelVersion;
97 }
98 }
99
100
101
102
103
104
105
106
107
108 @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
109 public void setModelVersion(String value) {
110 this.modelVersion = value;
111 }
112
113
114
115
116
117
118
119
120 @Override
121 @Generated(value = "com.sun.tools.xjc.Driver", date = "2015-05-31T05:43:54+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
122 public ToolsType clone() {
123 try {
124 {
125
126 final ToolsType clone = ((ToolsType) super.clone());
127
128 clone.modelVersion = ((this.modelVersion == null)?null:this.getModelVersion());
129 return clone;
130 }
131 } catch (CloneNotSupportedException e) {
132
133 throw new AssertionError(e);
134 }
135 }
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153 protected <T> javax.xml.bind.JAXBElement<T> getAnyElement( final java.util.List<Object> any,
154 final String namespaceURI,
155 final String localPart,
156 final Class<T> type )
157 {
158 if ( any == null )
159 {
160 throw new NullPointerException( "any" );
161 }
162 if ( namespaceURI == null )
163 {
164 throw new NullPointerException( "namespaceURI" );
165 }
166 if ( localPart == null )
167 {
168 throw new NullPointerException( "localPart" );
169 }
170 if ( type == null )
171 {
172 throw new NullPointerException( "type" );
173 }
174
175 javax.xml.bind.JAXBElement<?> anyElement = null;
176
177 for ( int i = 0, s0 = any.size(); i < s0; i++ )
178 {
179 final Object o = any.get( i );
180
181 if ( o instanceof javax.xml.bind.JAXBElement<?> )
182 {
183 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
184
185 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
186 && localPart.equals( e.getName().getLocalPart() ) )
187 {
188 if ( anyElement == null )
189 {
190 anyElement = e;
191 }
192 else
193 {
194 throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(),
195 namespaceURI, localPart ) );
196
197 }
198 }
199 }
200 }
201
202 if ( anyElement != null && anyElement.getValue() != null && anyElement.getValue().getClass().equals( type ) )
203 {
204 @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> e =
205 (javax.xml.bind.JAXBElement<T>) anyElement;
206
207 return e;
208 }
209
210 return null;
211 }
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229 protected <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final java.util.List<Object> any,
230 final String namespaceURI,
231 final String localPart,
232 final Class<T> type )
233 {
234 if ( any == null )
235 {
236 throw new NullPointerException( "any" );
237 }
238 if ( namespaceURI == null )
239 {
240 throw new NullPointerException( "namespaceURI" );
241 }
242 if ( localPart == null )
243 {
244 throw new NullPointerException( "localPart" );
245 }
246 if ( type == null )
247 {
248 throw new NullPointerException( "type" );
249 }
250
251 final java.util.List<javax.xml.bind.JAXBElement<T>> anyElements =
252 new java.util.ArrayList<javax.xml.bind.JAXBElement<T>>( any.size() );
253
254 for ( int i = 0, s0 = any.size(); i < s0; i++ )
255 {
256 final Object o = any.get( i );
257
258 if ( o instanceof javax.xml.bind.JAXBElement<?> )
259 {
260 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o;
261
262 if ( namespaceURI.equals( e.getName().getNamespaceURI() )
263 && localPart.equals( e.getName().getLocalPart() )
264 && e.getValue() != null && e.getValue().getClass().equals( type ) )
265 {
266 @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> anyElement =
267 (javax.xml.bind.JAXBElement<T>) e;
268
269 anyElements.add( anyElement );
270 }
271 }
272 }
273
274 return java.util.Collections.unmodifiableList( anyElements );
275 }
276
277
278
279
280
281
282
283
284
285
286
287
288
289 protected <T> T getAnyObject( final java.util.List<Object> any, final Class<T> clazz )
290 {
291 if ( any == null )
292 {
293 throw new NullPointerException( "any" );
294 }
295 if ( clazz == null )
296 {
297 throw new NullPointerException( "clazz" );
298 }
299
300 T anyObject = null;
301
302 for ( int i = 0, s0 = any.size(); i < s0; i++ )
303 {
304 Object o = any.get( i );
305
306 if ( o instanceof javax.xml.bind.JAXBElement<?> )
307 {
308 o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue();
309 }
310
311 if ( clazz.equals( o.getClass() ) )
312 {
313 if ( anyObject == null )
314 {
315 @SuppressWarnings( "unchecked" ) final T object = (T) o;
316 anyObject = object;
317 }
318 else
319 {
320 throw new IllegalStateException( getMessage( "nonUniqueObject", this.getClass().getName(),
321 clazz.getName() ) );
322
323 }
324 }
325 }
326
327 return anyObject;
328 }
329
330
331
332
333
334
335
336
337
338
339
340
341
342 protected <T> java.util.List<T> getAnyObjects( final java.util.List<Object> any, final Class<T> clazz )
343 {
344 if ( any == null )
345 {
346 throw new NullPointerException( "any" );
347 }
348 if ( clazz == null )
349 {
350 throw new NullPointerException( "namespaceURI" );
351 }
352
353 final java.util.List<T> anyElements = new java.util.ArrayList<T>( any.size() );
354
355 for ( int i = 0, s0 = any.size(); i < s0; i++ )
356 {
357 Object o = any.get( i );
358
359 if ( o instanceof javax.xml.bind.JAXBElement<?> )
360 {
361 o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue();
362 }
363
364 if ( clazz.equals( o.getClass() ) )
365 {
366 @SuppressWarnings( "unchecked" ) final T object = (T) o;
367 anyElements.add( object );
368 }
369 }
370
371 return java.util.Collections.unmodifiableList( anyElements );
372 }
373
374 private static String getMessage( final String key, final Object... args )
375 {
376 return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle(
377 ToolsType.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ).
378 getString( key ), args );
379 }
380
381 }