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