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