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 instances.
022 * @see Instance
023 *
024 *
025 *
026 */
027 @XmlAccessorType(XmlAccessType.FIELD)
028 @XmlType(name = "Instances", propOrder = {
029 "instance"
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 Instances
033 extends ModelObject
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<Instance> instance;
039
040 /**
041 * Creates a new {@code Instances} instance.
042 *
043 */
044 public Instances() {
045 // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
046 super();
047 }
048
049 /**
050 * Creates a new {@code Instances} instance by deeply copying a given {@code Instances} instance.
051 *
052 *
053 * @param o
054 * The instance to copy.
055 * @throws NullPointerException
056 * if {@code o} is {@code null}.
057 */
058 public Instances(final Instances 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 'Instances' from 'null'.");
063 }
064 // 'Instance' collection.
065 copyInstance(o.getInstance(), getInstance());
066 }
067
068 /**
069 * Gets the value of the instance 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 instance property.
076 *
077 * <p>
078 * For example, to add a new item, do as follows:
079 * <pre>
080 * getInstance().add(newItem);
081 * </pre>
082 *
083 *
084 * <p>
085 * Objects of the following type(s) are allowed in the list
086 * {@link Instance }
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<Instance> getInstance() {
092 if (instance == null) {
093 instance = new ArrayList<Instance>();
094 }
095 return this.instance;
096 }
097
098 /**
099 * Copies all values of property {@code Instance} 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 copyInstance(final List<Instance> source, final List<Instance> 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 Instance) {
116 // CClassInfo: org.jomc.model.Instance
117 target.add(((Instance) 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 'Instance' of class 'org.jomc.model.Instances'."));
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 Instances clone() {
136 // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
137 return new Instances(this);
138 }
139
140 /**
141 * Gets an instance for a given identifier from the list of instances.
142 *
143 * @param identifier The identifier of the instance to return.
144 *
145 * @return The instance identified by {@code identifier} from the list or
146 * {@code null}, if no instance matching {@code identifier} is found.
147 *
148 * @throws NullPointerException if {@code identifier} is {@code null}.
149 *
150 * @see #getInstance()
151 */
152 public Instance getInstance( final String identifier )
153 {
154 if ( identifier == null )
155 {
156 throw new NullPointerException( "identifier" );
157 }
158
159 for ( Instance i : this.getInstance() )
160 {
161 if ( i.getIdentifier().equals( identifier ) )
162 {
163 return i;
164 }
165 }
166
167 return null;
168 }
169
170
171 }