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.09.21 at 10:35:38 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 dependencies.
022     * @see Dependency
023     * 
024     * 
025     * 
026     */
027    @XmlAccessorType(XmlAccessType.FIELD)
028    @XmlType(name = "Dependencies", propOrder = {
029        "dependency"
030    })
031    @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-09-21T10:35:38+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
032    public class Dependencies
033        extends ModelObject
034        implements Cloneable
035    {
036    
037        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-09-21T10:35:38+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
038        protected List<Dependency> dependency;
039    
040        /**
041         * Creates a new {@code Dependencies} instance.
042         * 
043         */
044        public Dependencies() {
045             // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
046            super();
047        }
048    
049        /**
050         * Creates a new {@code Dependencies} instance by deeply copying a given instance.
051         * 
052         * @param o
053         *     The instance to copy or {@code null}.
054         */
055        public Dependencies(final Dependencies o) {
056             // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
057            super(o);
058            if (o!= null) {
059                {
060                    // 'Dependency' collection.
061                    copyDependency(o.getDependency(), getDependency());
062                }
063            }
064        }
065    
066        /**
067         * Gets the value of the dependency property.
068         * 
069         * <p>
070         * This accessor method returns a reference to the live list,
071         * not a snapshot. Therefore any modification you make to the
072         * returned list will be present inside the JAXB object.
073         * This is why there is not a <CODE>set</CODE> method for the dependency property.
074         * 
075         * <p>
076         * For example, to add a new item, do as follows:
077         * <pre>
078         *    getDependency().add(newItem);
079         * </pre>
080         * 
081         * 
082         * <p>
083         * Objects of the following type(s) are allowed in the list
084         * {@link Dependency }
085         * 
086         * 
087         */
088        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-09-21T10:35:38+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
089        public List<Dependency> getDependency() {
090            if (dependency == null) {
091                dependency = new ArrayList<Dependency>();
092            }
093            return this.dependency;
094        }
095    
096        /**
097         * Copies all values of property {@code Dependency} deeply.
098         * 
099         * @param target
100         *     The target to copy {@code source} to.
101         * @param source
102         *     The source to copy from.
103         * @throws NullPointerException
104         *     if {@code source} or {@code target} is {@code null}.
105         */
106        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-09-21T10:35:38+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
107        private static void copyDependency(final List<Dependency> source, final List<Dependency> target) {
108            // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
109            if (!source.isEmpty()) {
110                for (Iterator it = source.iterator(); it.hasNext(); ) {
111                    final Object next = it.next();
112                    if (next instanceof Dependency) {
113                        // CClassInfo: org.jomc.model.Dependency
114                        target.add(((Dependency) next).clone());
115                        continue;
116                    }
117                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
118                    throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Dependency' of class 'org.jomc.model.Dependencies'."));
119                }
120            }
121        }
122    
123        /**
124         * Creates and returns a deep copy of this object.
125         * 
126         * 
127         * @return
128         *     A deep copy of this object.
129         */
130        @Override
131        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-09-21T10:35:38+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
132        public Dependencies clone() {
133             // CC-XJC Version 1.0 Build 2009-09-18T15:48:40+0000
134            return new Dependencies(this);
135        }
136        
137        /**
138         * Gets a dependency for a given name from the list of dependencies.
139         *
140         * @param name The name of the dependency to return.
141         *
142         * @return The dependency with name {@code name} from the list or
143         * {@code null}, if no dependency matching {@code name} is found.
144         *
145         * @throws NullPointerException if {@code name} is {@code null}.
146         *
147         * @see #getDependency()
148         */
149        public Dependency getDependency( final String name )
150        {
151            if ( name == null )
152            {
153                throw new NullPointerException( "identifier" );
154            }
155    
156            for ( Dependency d : this.getDependency() )
157            {
158                if ( name.equals( d.getName() ) )
159                {
160                    return d;
161                }
162            }
163    
164            return null;
165        }
166    
167    }