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