001 //
002 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
003 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
004 // Any modifications to this file will be lost upon recompilation of the source schema.
005 // Generated on: 2009.10.02 at 06:07:50 PM UTC
006 //
007
008
009 package org.jomc.model;
010
011 import java.util.ArrayList;
012 import java.util.Iterator;
013 import java.util.List;
014 import javax.annotation.Generated;
015 import javax.xml.bind.annotation.XmlAccessType;
016 import javax.xml.bind.annotation.XmlAccessorType;
017 import javax.xml.bind.annotation.XmlType;
018
019
020 /**
021 * List of specifications.
022 * @see Specification
023 *
024 *
025 *
026 */
027 @XmlAccessorType(XmlAccessType.FIELD)
028 @XmlType(name = "Specifications", propOrder = {
029 "specification",
030 "reference"
031 })
032 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:07:50+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
033 public class Specifications
034 extends ModelObject
035 implements Cloneable
036 {
037
038 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:07:50+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
039 protected List<Specification> specification;
040 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:07:50+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
041 protected List<SpecificationReference> reference;
042
043 /**
044 * Creates a new {@code Specifications} instance.
045 *
046 */
047 public Specifications() {
048 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
049 super();
050 }
051
052 /**
053 * Creates a new {@code Specifications} instance by deeply copying a given instance.
054 *
055 * @param o
056 * The instance to copy or {@code null}.
057 */
058 public Specifications(final Specifications o) {
059 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
060 super(o);
061 if (o!= null) {
062 {
063 // 'Specification' collection.
064 copySpecification(o.getSpecification(), getSpecification());
065 // 'Reference' collection.
066 copyReference(o.getReference(), getReference());
067 }
068 }
069 }
070
071 /**
072 * Gets the value of the specification property.
073 *
074 * <p>
075 * This accessor method returns a reference to the live list,
076 * not a snapshot. Therefore any modification you make to the
077 * returned list will be present inside the JAXB object.
078 * This is why there is not a <CODE>set</CODE> method for the specification property.
079 *
080 * <p>
081 * For example, to add a new item, do as follows:
082 * <pre>
083 * getSpecification().add(newItem);
084 * </pre>
085 *
086 *
087 * <p>
088 * Objects of the following type(s) are allowed in the list
089 * {@link Specification }
090 *
091 *
092 */
093 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:07:50+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
094 public List<Specification> getSpecification() {
095 if (specification == null) {
096 specification = new ArrayList<Specification>();
097 }
098 return this.specification;
099 }
100
101 /**
102 * Gets the value of the reference property.
103 *
104 * <p>
105 * This accessor method returns a reference to the live list,
106 * not a snapshot. Therefore any modification you make to the
107 * returned list will be present inside the JAXB object.
108 * This is why there is not a <CODE>set</CODE> method for the reference property.
109 *
110 * <p>
111 * For example, to add a new item, do as follows:
112 * <pre>
113 * getReference().add(newItem);
114 * </pre>
115 *
116 *
117 * <p>
118 * Objects of the following type(s) are allowed in the list
119 * {@link SpecificationReference }
120 *
121 *
122 */
123 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:07:50+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
124 public List<SpecificationReference> getReference() {
125 if (reference == null) {
126 reference = new ArrayList<SpecificationReference>();
127 }
128 return this.reference;
129 }
130
131 /**
132 * Copies all values of property {@code Specification} deeply.
133 *
134 * @param target
135 * The target to copy {@code source} to.
136 * @param source
137 * The source to copy from.
138 * @throws NullPointerException
139 * if {@code source} or {@code target} is {@code null}.
140 */
141 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:07:50+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
142 private static void copySpecification(final List<Specification> source, final List<Specification> target) {
143 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
144 if (!source.isEmpty()) {
145 for (Iterator it = source.iterator(); it.hasNext(); ) {
146 final Object next = it.next();
147 if (next instanceof Specification) {
148 // CClassInfo: org.jomc.model.Specification
149 target.add(((Specification) next).clone());
150 continue;
151 }
152 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
153 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Specification' of class 'org.jomc.model.Specifications'."));
154 }
155 }
156 }
157
158 /**
159 * Copies all values of property {@code Reference} deeply.
160 *
161 * @param target
162 * The target to copy {@code source} to.
163 * @param source
164 * The source to copy from.
165 * @throws NullPointerException
166 * if {@code source} or {@code target} is {@code null}.
167 */
168 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:07:50+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
169 private static void copyReference(final List<SpecificationReference> source, final List<SpecificationReference> target) {
170 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
171 if (!source.isEmpty()) {
172 for (Iterator it = source.iterator(); it.hasNext(); ) {
173 final Object next = it.next();
174 if (next instanceof SpecificationReference) {
175 // CClassInfo: org.jomc.model.SpecificationReference
176 target.add(((SpecificationReference) next).clone());
177 continue;
178 }
179 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
180 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Reference' of class 'org.jomc.model.Specifications'."));
181 }
182 }
183 }
184
185 /**
186 * Creates and returns a deep copy of this object.
187 *
188 *
189 * @return
190 * A deep copy of this object.
191 */
192 @Override
193 @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-02T06:07:50+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
194 public Specifications clone() {
195 // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
196 return new Specifications(this);
197 }
198
199 /**
200 * Gets a specification for a given identifier from the list of
201 * specifications.
202 *
203 * @param specification The identifier of the specification to return.
204 *
205 * @return The specification identified by {@code specification} from the
206 * list or {@code null}, if no specification matching {@code specification}
207 * is found.
208 *
209 * @throws NullPointerException if {@code specification} is {@code null}.
210 *
211 * @see #getSpecification()
212 */
213 public Specification getSpecification( final String specification )
214 {
215 if ( specification == null )
216 {
217 throw new NullPointerException( "specification" );
218 }
219
220 for ( Specification s : this.getSpecification() )
221 {
222 if ( specification.equals( s.getIdentifier() ) )
223 {
224 return s;
225 }
226 }
227
228 return null;
229 }
230
231 /**
232 * Gets a specification for a given class from the list of specifications.
233 *
234 * @param specification The class of the specification to return.
235 *
236 * @return The specification identified by {@code specification} from the list or {@code null}, if no specification
237 * matching {@code specification} is found.
238 *
239 * @throws NullPointerException if {@code specification} is {@code null}.
240 *
241 * @see #getSpecification()
242 */
243 public Specification getSpecification( final Class specification )
244 {
245 if ( specification == null )
246 {
247 throw new NullPointerException( "specification" );
248 }
249
250 for ( Specification s : this.getSpecification() )
251 {
252 if ( specification.getName().equals( s.getIdentifier() ) &&
253 s.getIdentifier().equals( s.getClazz() ) )
254 {
255 return s;
256 }
257 }
258
259 return null;
260 }
261
262 /**
263 * Gets a specification reference for a given identifier from the list of
264 * references.
265 *
266 * @param specification The identifier of the reference to return.
267 *
268 * @return The specification reference identified by {@code specification}
269 * from the list or {@code null}, if no specification reference matching
270 * {@code specification} is found.
271 *
272 * @throws NullPointerException if {@code specification} is {@code null}.
273 *
274 * @see #getReference()
275 */
276 public SpecificationReference getReference( final String specification )
277 {
278 if ( specification == null )
279 {
280 throw new NullPointerException( "specification" );
281 }
282
283 for ( SpecificationReference r : this.getReference() )
284 {
285 if ( specification.equals( r.getIdentifier() ) )
286 {
287 return r;
288 }
289 }
290
291 return null;
292 }
293
294
295 }