001    //
002    // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 
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: 2012.04.01 at 02:20:36 AM CEST 
006    //
007    
008    
009    package org.jomc.modlet;
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.XmlElement;
018    import javax.xml.bind.annotation.XmlType;
019    
020    
021    /**
022     * List of schemas.
023     * 
024     * <p>Java class for Schemas complex type.
025     * 
026     * <p>The following schema fragment specifies the expected content contained within this class.
027     * 
028     * <pre>
029     * &lt;complexType name="Schemas">
030     *   &lt;complexContent>
031     *     &lt;extension base="{http://jomc.org/modlet}ModletObject">
032     *       &lt;sequence>
033     *         &lt;element ref="{http://jomc.org/modlet}schema" 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 = "Schemas", namespace = "http://jomc.org/modlet", propOrder = {
044        "schema"
045    })
046    @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-01T02:20:36+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
047    public class Schemas
048        extends ModletObject
049        implements Cloneable
050    {
051    
052        @XmlElement(namespace = "http://jomc.org/modlet")
053        @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-01T02:20:36+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
054        protected List<Schema> schema;
055    
056        /**
057         * Creates a new {@code Schemas} instance.
058         * 
059         */
060        public Schemas() {
061            // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
062            super();
063        }
064    
065        /**
066         * Creates a new {@code Schemas} instance by deeply copying a given {@code Schemas} instance.
067         * 
068         * 
069         * @param o
070         *     The instance to copy.
071         * @throws NullPointerException
072         *     if {@code o} is {@code null}.
073         */
074        public Schemas(final Schemas o) {
075            // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
076            super(o);
077            if (o == null) {
078                throw new NullPointerException("Cannot create a copy of 'Schemas' from 'null'.");
079            }
080            // 'Schema' collection.
081            if (o.schema!= null) {
082                copySchema(o.getSchema(), this.getSchema());
083            }
084        }
085    
086        /**
087         * Gets the value of the schema property.
088         * 
089         * <p>
090         * This accessor method returns a reference to the live list,
091         * not a snapshot. Therefore any modification you make to the
092         * returned list will be present inside the JAXB object.
093         * This is why there is not a <CODE>set</CODE> method for the schema property.
094         * 
095         * <p>
096         * For example, to add a new item, do as follows:
097         * <pre>
098         *    getSchema().add(newItem);
099         * </pre>
100         * 
101         * 
102         * <p>
103         * Objects of the following type(s) are allowed in the list
104         * {@link Schema }
105         * 
106         * 
107         */
108        @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-01T02:20:36+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
109        public List<Schema> getSchema() {
110            if (schema == null) {
111                schema = new ArrayList<Schema>();
112            }
113            return this.schema;
114        }
115    
116        /**
117         * Copies all values of property {@code Schema} deeply.
118         * 
119         * @param source
120         *     The source to copy from.
121         * @param target
122         *     The target to copy {@code source} to.
123         * @throws NullPointerException
124         *     if {@code target} is {@code null}.
125         */
126        @SuppressWarnings("unchecked")
127        @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-01T02:20:36+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
128        private static void copySchema(final List<Schema> source, final List<Schema> target) {
129            // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
130            if ((source!= null)&&(!source.isEmpty())) {
131                for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
132                    final Object next = it.next();
133                    if (next instanceof Schema) {
134                        // CClassInfo: org.jomc.modlet.Schema
135                        target.add(((Schema) next).clone());
136                        continue;
137                    }
138                    // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
139                    throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Schema' of class 'org.jomc.modlet.Schemas'."));
140                }
141            }
142        }
143    
144        /**
145         * Creates and returns a deep copy of this object.
146         * 
147         * 
148         * @return
149         *     A deep copy of this object.
150         */
151        @Override
152        @Generated(value = "com.sun.tools.xjc.Driver", date = "2012-04-01T02:20:36+02:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
153        public Schemas clone() {
154            {
155                // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
156                final Schemas clone = ((Schemas) super.clone());
157                // 'Schema' collection.
158                if (this.schema!= null) {
159                    clone.schema = null;
160                    copySchema(this.getSchema(), clone.getSchema());
161                }
162                return clone;
163            }
164        }
165        
166        /**
167         * Gets a schema for a given public identifier from the list of schemas.
168         *
169         * @param publicId The public identifier of the schema to return.
170         *
171         * @return The first matching schema or {@code null}, if no such schema is found.
172         *
173         * @throws NullPointerException if {@code publicId} is {@code null}.
174         *
175         * @see #getSchema()
176         * @see Schema#getPublicId()
177         * @deprecated As of JOMC 1.2, replaced by method {@link #getSchemasByPublicId(java.net.URI)}. This method will be
178         * removed in version 2.0.
179         */
180        @Deprecated
181        public Schema getSchemaByPublicId( final String publicId )
182        {
183            if ( publicId == null )
184            {
185                throw new NullPointerException( "publicId" );
186            }
187    
188            for ( int i = 0, s0 = this.getSchema().size(); i < s0; i++ )
189            {
190                final Schema s = this.getSchema().get( i );
191    
192                if ( publicId.equals( s.getPublicId() ) )
193                {
194                    return s;
195                }
196            }
197    
198            return null;
199        }
200    
201        /**
202         * Gets a schema for a given system identifier from the list of schemas.
203         *
204         * @param systemId The system identifier of the schema to return.
205         *
206         * @return The first matching schema or {@code null}, if no such schema is found.
207         *
208         * @throws NullPointerException if {@code systemId} is {@code null}.
209         *
210         * @see #getSchema()
211         * @see Schema#getSystemId()
212         */
213        public Schema getSchemaBySystemId( final String systemId )
214        {
215            if ( systemId == null )
216            {
217                throw new NullPointerException( "systemId" );
218            }
219    
220            for ( int i = 0, s0 = this.getSchema().size(); i < s0; i++ )
221            {
222                final Schema s = this.getSchema().get( i );
223    
224                if ( systemId.equals( s.getSystemId() ) )
225                {
226                    return s;
227                }
228            }
229    
230            return null;
231        }
232    
233        /**
234         * Gets a list of schemas for a given public identifier from the list of schemas.
235         *
236         * @param publicId The public identifier of the schemas to return.
237         *
238         * @return An unmodifiable list of schemas matching {@code publicId} or an empty list, if no such schemas are found.
239         *
240         * @throws NullPointerException if {@code publicId} is {@code null}.
241         *
242         * @see #getSchema()
243         * @see Schema#getPublicIdUri()
244         * @since 1.2
245         */
246        public List<Schema> getSchemasByPublicId( final java.net.URI publicId )
247        {
248            if ( publicId == null )
249            {
250                throw new NullPointerException( "publicId" );
251            }
252    
253            final List<Schema> schemas = new ArrayList<Schema>( this.getSchema().size() );
254    
255            for ( int i = 0, s0 = this.getSchema().size(); i < s0; i++ )
256            {
257                final Schema s = this.getSchema().get( i );
258    
259                if ( publicId.equals( s.getPublicIdUri() ) )
260                {
261                    schemas.add( s );
262                }
263            }
264    
265            return java.util.Collections.unmodifiableList( schemas );
266        }
267          
268    }