1
2
3
4
5
6
7
8
9 package org.jomc.model;
10
11 import java.util.ArrayList;
12 import java.util.Iterator;
13 import java.util.List;
14 import javax.annotation.Generated;
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlElement;
18 import javax.xml.bind.annotation.XmlType;
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 @XmlAccessorType(XmlAccessType.FIELD)
44 @XmlType(name = "Specifications", namespace = "http://jomc.org/model", propOrder = {
45 "specification",
46 "reference"
47 })
48 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
49 public class Specifications
50 extends ModelObject
51 implements Cloneable
52 {
53
54 @XmlElement(namespace = "http://jomc.org/model")
55 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
56 protected List<Specification> specification;
57 @XmlElement(namespace = "http://jomc.org/model")
58 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
59 protected List<SpecificationReference> reference;
60
61
62
63
64
65 public Specifications() {
66
67 super();
68 }
69
70
71
72
73
74
75
76
77
78
79 public Specifications(final Specifications o) {
80
81 super(o);
82 if (o == null) {
83 throw new NullPointerException("Cannot create a copy of 'Specifications' from 'null'.");
84 }
85
86 if (o.specification!= null) {
87 copySpecification(o.getSpecification(), this.getSpecification());
88 }
89
90 if (o.reference!= null) {
91 copyReference(o.getReference(), this.getReference());
92 }
93 }
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
118 public List<Specification> getSpecification() {
119 if (specification == null) {
120 specification = new ArrayList<Specification>();
121 }
122 return this.specification;
123 }
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
148 public List<SpecificationReference> getReference() {
149 if (reference == null) {
150 reference = new ArrayList<SpecificationReference>();
151 }
152 return this.reference;
153 }
154
155
156
157
158
159
160
161
162
163
164
165 @SuppressWarnings("unchecked")
166 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
167 private static void copySpecification(final List<Specification> source, final List<Specification> target) {
168
169 if ((source!= null)&&(!source.isEmpty())) {
170 for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
171 final Object next = it.next();
172 if (next instanceof Specification) {
173
174 target.add(((Specification) next).clone());
175 continue;
176 }
177
178 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Specification' of class 'org.jomc.model.Specifications'."));
179 }
180 }
181 }
182
183
184
185
186
187
188
189
190
191
192
193 @SuppressWarnings("unchecked")
194 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
195 private static void copyReference(final List<SpecificationReference> source, final List<SpecificationReference> target) {
196
197 if ((source!= null)&&(!source.isEmpty())) {
198 for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
199 final Object next = it.next();
200 if (next instanceof SpecificationReference) {
201
202 target.add(((SpecificationReference) next).clone());
203 continue;
204 }
205
206 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Reference' of class 'org.jomc.model.Specifications'."));
207 }
208 }
209 }
210
211
212
213
214
215
216
217
218 @Override
219 @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-03-28T01:26:51+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
220 public Specifications clone() {
221 {
222
223 final Specifications clone = ((Specifications) super.clone());
224
225 if (this.specification!= null) {
226 clone.specification = null;
227 copySpecification(this.getSpecification(), clone.getSpecification());
228 }
229
230 if (this.reference!= null) {
231 clone.reference = null;
232 copyReference(this.getReference(), clone.getReference());
233 }
234 return clone;
235 }
236 }
237
238
239
240
241
242
243
244
245
246
247
248
249
250 public Specification getSpecification( final String specification )
251 {
252 if ( specification == null )
253 {
254 throw new NullPointerException( "specification" );
255 }
256
257 for ( int i = 0, s0 = this.getSpecification().size(); i < s0; i++ )
258 {
259 final Specification s = this.getSpecification().get( i );
260
261 if ( specification.equals( s.getIdentifier() ) )
262 {
263 return s;
264 }
265 }
266
267 return null;
268 }
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283 public Specification getSpecification( final Class<?> specification )
284 {
285 if ( specification == null )
286 {
287 throw new NullPointerException( "specification" );
288 }
289
290 for ( int i = 0, s0 = this.getSpecification().size(); i < s0; i++ )
291 {
292 final Specification s = this.getSpecification().get( i );
293
294 if ( s.isClassDeclaration() && specification.getName().equals( s.getClazz() ) )
295 {
296 return s;
297 }
298 }
299
300 return null;
301 }
302
303
304
305
306
307
308
309
310
311
312
313
314
315 public SpecificationReference getReference( final String specification )
316 {
317 if ( specification == null )
318 {
319 throw new NullPointerException( "specification" );
320 }
321
322 for ( int i = 0, s0 = this.getReference().size(); i < s0; i++ )
323 {
324 final SpecificationReference r = this.getReference().get( i );
325
326 if ( specification.equals( r.getIdentifier() ) )
327 {
328 return r;
329 }
330 }
331
332 return null;
333 }
334
335 }