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