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 })
46 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-06-03T09:56:13+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 = "2012-06-03T09:56:13+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
52 protected String modelVersion;
53
54
55
56
57
58 public ToolsType() {
59
60 super();
61 }
62
63
64
65
66
67
68
69
70
71
72 public ToolsType(final ToolsType o) {
73
74 super();
75 if (o == null) {
76 throw new NullPointerException("Cannot create a copy of 'ToolsType' from 'null'.");
77 }
78
79 this.modelVersion = ((o.modelVersion == null)?null:o.getModelVersion());
80 }
81
82
83
84
85
86
87
88
89
90 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-06-03T09:56:13+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
101
102
103
104
105
106
107 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-06-03T09:56:13+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
114
115
116
117
118
119 @Override
120 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-06-03T09:56:13+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
121 public ToolsType clone() {
122 try {
123 {
124
125 final ToolsType clone = ((ToolsType) super.clone());
126
127 clone.modelVersion = ((this.modelVersion == null)?null:this.getModelVersion());
128 return clone;
129 }
130 } catch (CloneNotSupportedException e) {
131
132 throw new AssertionError(e);
133 }
134 }
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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
214
215
216
217
218
219
220
221
222
223
224
225
226
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
278
279
280
281
282
283
284
285
286
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
331
332
333
334
335
336
337
338
339
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 }