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.06 at 06:45:27 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 implementations.
022     * @see Implementation
023     * 
024     * 
025     * 
026     */
027    @XmlAccessorType(XmlAccessType.FIELD)
028    @XmlType(name = "Implementations", propOrder = {
029        "implementation",
030        "reference"
031    })
032    @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-06T06:45:27+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
033    public class Implementations
034        extends ModelObject
035        implements Cloneable
036    {
037    
038        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-06T06:45:27+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
039        protected List<Implementation> implementation;
040        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-06T06:45:27+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
041        protected List<ImplementationReference> reference;
042    
043        /**
044         * Creates a new {@code Implementations} instance.
045         * 
046         */
047        public Implementations() {
048             // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
049            super();
050        }
051    
052        /**
053         * Creates a new {@code Implementations} instance by deeply copying a given instance.
054         * 
055         * @param o
056         *     The instance to copy or {@code null}.
057         */
058        public Implementations(final Implementations o) {
059             // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
060            super(o);
061            if (o!= null) {
062                {
063                    // 'Implementation' collection.
064                    copyImplementation(o.getImplementation(), getImplementation());
065                    // 'Reference' collection.
066                    copyReference(o.getReference(), getReference());
067                }
068            }
069        }
070    
071        /**
072         * Gets the value of the implementation 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 implementation property.
079         * 
080         * <p>
081         * For example, to add a new item, do as follows:
082         * <pre>
083         *    getImplementation().add(newItem);
084         * </pre>
085         * 
086         * 
087         * <p>
088         * Objects of the following type(s) are allowed in the list
089         * {@link Implementation }
090         * 
091         * 
092         */
093        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-06T06:45:27+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
094        public List<Implementation> getImplementation() {
095            if (implementation == null) {
096                implementation = new ArrayList<Implementation>();
097            }
098            return this.implementation;
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 ImplementationReference }
120         * 
121         * 
122         */
123        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-10-06T06:45:27+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
124        public List<ImplementationReference> getReference() {
125            if (reference == null) {
126                reference = new ArrayList<ImplementationReference>();
127            }
128            return this.reference;
129        }
130    
131        /**
132         * Copies all values of property {@code Implementation} 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-06T06:45:27+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
142        private static void copyImplementation(final List<Implementation> source, final List<Implementation> 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 Implementation) {
148                        // CClassInfo: org.jomc.model.Implementation
149                        target.add(((Implementation) 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 'Implementation' of class 'org.jomc.model.Implementations'."));
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-06T06:45:27+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
169        private static void copyReference(final List<ImplementationReference> source, final List<ImplementationReference> 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 ImplementationReference) {
175                        // CClassInfo: org.jomc.model.ImplementationReference
176                        target.add(((ImplementationReference) 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.Implementations'."));
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-06T06:45:27+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
194        public Implementations clone() {
195             // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
196            return new Implementations(this);
197        }
198        
199        /**
200         * Gets an implementation for a given identifier from the list.
201         *
202         * @param implementation The identifier of the implementation to return.
203         *
204         * @return The implementation identified by {@code implementation} from the
205         * list or {@code null}, if no implementation matching
206         * {@code implementation} is found.
207         *
208         * @throws NullPointerException if {@code implementation} is {@code null}.
209         */
210        public Implementation getImplementation( final String implementation )
211        {
212            if ( implementation == null )
213            {
214                throw new NullPointerException( "implementation" );
215            }
216    
217            for ( Implementation i : this.getImplementation() )
218            {
219                if ( implementation.equals( i.getIdentifier() ) )
220                {
221                    return i;
222                }
223            }
224    
225            return null;
226        }
227    
228        /**
229         * Gets an implementation for a given class from the list.
230         *
231         * @param implementation The class of the implementation to return.
232         *
233         * @return The implementation identified by {@code implementation} from the
234         * list or {@code null}, if no implementation matching
235         * {@code implementation} is found.
236         *
237         * @throws NullPointerException if {@code implementation} is {@code null}.
238         */
239        public Implementation getImplementation( final Class implementation )
240        {
241            if ( implementation == null )
242            {
243                throw new NullPointerException( "implementation" );
244            }
245    
246            for ( Implementation i : this.getImplementation() )
247            {
248                if ( implementation.getName().equals( i.getIdentifier() ) &&
249                     i.getIdentifier().equals( i.getClazz() ) )
250                {
251                    return i;
252                }
253            }
254    
255            return null;
256        }
257    
258        /**
259         * Gets an implementation for a given name from the list.
260         *
261         * @param name The name of the implementation to return.
262         *
263         * @return The implementation named {@code name} from the list or
264         * {@code null}, if no implementation matching {@code name} is found.
265         *
266         * @throws NullPointerException if {@code name} is {@code null}.
267         */
268        public Implementation getImplementationByName( final String name )
269        {
270            if ( name == null )
271            {
272                throw new NullPointerException( "name" );
273            }
274    
275            for ( Implementation i : this.getImplementation() )
276            {
277                if ( name.equals( i.getName() ) )
278                {
279                    return i;
280                }
281            }
282    
283            return null;
284        }
285    
286        /**
287         * Gets an implementation reference for a given identifier from the list of
288         * references.
289         *
290         * @param implementation The identifier of the reference to return.
291         *
292         * @return The implementation reference identified by {@code implementation}
293         * from the list or {@code null}, if no implementation reference matching
294         * {@code implementation} is found.
295         *
296         * @throws NullPointerException if {@code implementation} is {@code null}.
297         *
298         * @see #getReference()
299         */
300        public ImplementationReference getReference( final String implementation )
301        {
302            if ( implementation == null )
303            {
304                throw new NullPointerException( "implementation" );
305            }
306    
307            for ( ImplementationReference r : this.getReference() )
308            {
309                if ( implementation.equals( r.getIdentifier() ) )
310                {
311                    return r;
312                }
313            }
314    
315            return null;
316        }
317    
318          
319    }