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.bootstrap;
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 schemas.
022     * @see Schema
023     * 
024     * 
025     * 
026     */
027    @XmlAccessorType(XmlAccessType.FIELD)
028    @XmlType(name = "Schemas", propOrder = {
029        "schema"
030    })
031    @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
032    public class Schemas
033        extends BootstrapObject
034        implements Cloneable
035    {
036    
037        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
038        protected List<Schema> schema;
039    
040        /**
041         * Creates a new {@code Schemas} instance.
042         * 
043         */
044        public Schemas() {
045            // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
046            super();
047        }
048    
049        /**
050         * Creates a new {@code Schemas} instance by deeply copying a given {@code Schemas} instance.
051         * 
052         * 
053         * @param o
054         *     The instance to copy.
055         * @throws NullPointerException
056         *     if {@code o} is {@code null}.
057         */
058        public Schemas(final Schemas o) {
059            // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
060            super(o);
061            if (o == null) {
062                throw new NullPointerException("Cannot create a copy of 'Schemas' from 'null'.");
063            }
064            // 'Schema' collection.
065            copySchema(o.getSchema(), getSchema());
066        }
067    
068        /**
069         * Gets the value of the schema property.
070         * 
071         * <p>
072         * This accessor method returns a reference to the live list,
073         * not a snapshot. Therefore any modification you make to the
074         * returned list will be present inside the JAXB object.
075         * This is why there is not a <CODE>set</CODE> method for the schema property.
076         * 
077         * <p>
078         * For example, to add a new item, do as follows:
079         * <pre>
080         *    getSchema().add(newItem);
081         * </pre>
082         * 
083         * 
084         * <p>
085         * Objects of the following type(s) are allowed in the list
086         * {@link Schema }
087         * 
088         * 
089         */
090        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
091        public List<Schema> getSchema() {
092            if (schema == null) {
093                schema = new ArrayList<Schema>();
094            }
095            return this.schema;
096        }
097    
098        /**
099         * Copies all values of property {@code Schema} deeply.
100         * 
101         * @param target
102         *     The target to copy {@code source} to.
103         * @param source
104         *     The source to copy from.
105         * @throws NullPointerException
106         *     if {@code source} or {@code target} is {@code null}.
107         */
108        @SuppressWarnings("unchecked")
109        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
110        private static void copySchema(final List<Schema> source, final List<Schema> target) {
111            // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
112            if (!source.isEmpty()) {
113                for (Iterator it = source.iterator(); it.hasNext(); ) {
114                    final Object next = it.next();
115                    if (next instanceof Schema) {
116                        // CClassInfo: org.jomc.model.bootstrap.Schema
117                        target.add(((Schema) next).clone());
118                        continue;
119                    }
120                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
121                    throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Schema' of class 'org.jomc.model.bootstrap.Schemas'."));
122                }
123            }
124        }
125    
126        /**
127         * Creates and returns a deep copy of this object.
128         * 
129         * 
130         * @return
131         *     A deep copy of this object.
132         */
133        @Override
134        @Generated(value = "com.sun.tools.xjc.Driver", date = "2009-11-18T06:28:36+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833")
135        public Schemas clone() {
136            // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
137            return new Schemas(this);
138        }
139        
140        /**
141         * Gets a schema for a given public id from this list of schemas.
142         *
143         * @param publicId The public id of the schema to return.
144         *
145         * @return The schema with public id {@code publicId} from the list or {@code null}
146         * if no schema matching {@code publicId} is found.
147         *
148         * @throws NullPointerException if {@code publicId} is {@code null}.
149         *
150         * @see #getSchema()
151         */
152        public Schema getSchemaByPublicId( final String publicId )
153        {
154            if ( publicId == null )
155            {
156                throw new NullPointerException( "publicId" );
157            }
158    
159            for ( Schema s : this.getSchema() )
160            {
161                if ( publicId.equals( s.getPublicId() ) )
162                {
163                    return s;
164                }
165            }
166    
167            return null;
168        }
169    
170        /**
171         * Gets a schema for a given system id from this list of schemas.
172         *
173         * @param systemId The system id of the schema to return.
174         *
175         * @return The schema with system id {@code systemId} from the list or {@code null}
176         * if no schema matching {@code systemId} is found.
177         *
178         * @throws NullPointerException if {@code systemId} is {@code null}.
179         *
180         * @see #getSchema()
181         */
182        public Schema getSchemaBySystemId( final String systemId )
183        {
184            if ( systemId == null )
185            {
186                throw new NullPointerException( "systemId" );
187            }
188    
189            for ( Schema s : this.getSchema() )
190            {
191                if ( systemId.equals( s.getSystemId() ) )
192                {
193                    return s;
194                }
195            }
196    
197            return null;
198        }
199    
200    }