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 messages.
022 * @see Message
023 *
024 *
025 *
026 */
027 @XmlAccessorType(XmlAccessType.FIELD)
028 @XmlType(name = "Messages", propOrder = {
029 "message",
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 Messages
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<Message> message;
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<MessageReference> reference;
042
043 /**
044 * Creates a new {@code Messages} instance.
045 *
046 */
047 public Messages() {
048 // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
049 super();
050 }
051
052 /**
053 * Creates a new {@code Messages} instance by deeply copying a given {@code Messages} instance.
054 *
055 *
056 * @param o
057 * The instance to copy.
058 * @throws NullPointerException
059 * if {@code o} is {@code null}.
060 */
061 public Messages(final Messages 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 'Messages' from 'null'.");
066 }
067 // 'Message' collection.
068 copyMessage(o.getMessage(), getMessage());
069 // 'Reference' collection.
070 copyReference(o.getReference(), getReference());
071 }
072
073 /**
074 * Gets the value of the message 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 message property.
081 *
082 * <p>
083 * For example, to add a new item, do as follows:
084 * <pre>
085 * getMessage().add(newItem);
086 * </pre>
087 *
088 *
089 * <p>
090 * Objects of the following type(s) are allowed in the list
091 * {@link Message }
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<Message> getMessage() {
097 if (message == null) {
098 message = new ArrayList<Message>();
099 }
100 return this.message;
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 MessageReference }
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<MessageReference> getReference() {
127 if (reference == null) {
128 reference = new ArrayList<MessageReference>();
129 }
130 return this.reference;
131 }
132
133 /**
134 * Copies all values of property {@code Message} 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 copyMessage(final List<Message> source, final List<Message> 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 Message) {
151 // CClassInfo: org.jomc.model.Message
152 target.add(((Message) 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 'Message' of class 'org.jomc.model.Messages'."));
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<MessageReference> source, final List<MessageReference> 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 MessageReference) {
179 // CClassInfo: org.jomc.model.MessageReference
180 target.add(((MessageReference) 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.Messages'."));
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 Messages clone() {
199 // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000
200 return new Messages(this);
201 }
202
203 /**
204 * Gets a message for a given name from the list of messages.
205 *
206 * @param name The name of the message to return.
207 *
208 * @return The message with name {@code name} from the list or {@code null},
209 * if no message matching {@code name} is found.
210 *
211 * @throws NullPointerException if {@code name} is {@code null}.
212 *
213 * @see #getMessage()
214 */
215 public Message getMessage( final String name )
216 {
217 if ( name == null )
218 {
219 throw new NullPointerException( "name" );
220 }
221
222 for ( Message m : this.getMessage() )
223 {
224 if ( name.equals( m.getName() ) )
225 {
226 return m;
227 }
228 }
229
230 return null;
231 }
232
233 /**
234 * Gets a message reference for a given name from the list of references.
235 *
236 * @param name The name of the message reference to return.
237 *
238 * @return The message reference with name {@code name} from the list or
239 * {@code null}, if no message reference matching {@code name} is found.
240 *
241 * @throws NullPointerException if {@code name} is {@code null}.
242 *
243 * @see #getReference()
244 */
245 public MessageReference getReference( final String name )
246 {
247 if ( name == null )
248 {
249 throw new NullPointerException( "name" );
250 }
251
252 for ( MessageReference r : this.getReference() )
253 {
254 if ( name.equals( r.getName() ) )
255 {
256 return r;
257 }
258 }
259
260 return null;
261 }
262
263
264 }