| 1 | // |
| 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 |
| 3 | // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> |
| 4 | // Any modifications to this file will be lost upon recompilation of the source schema. |
| 5 | // Generated on: 2014.02.21 at 04:13:17 AM CET |
| 6 | // |
| 7 | |
| 8 | |
| 9 | package org.jomc.model; |
| 10 | |
| 11 | import java.util.ArrayList; |
| 12 | import java.util.Iterator; |
| 13 | import java.util.List; |
| 14 | import javax.annotation.Generated; |
| 15 | import javax.xml.bind.annotation.XmlAccessType; |
| 16 | import javax.xml.bind.annotation.XmlAccessorType; |
| 17 | import javax.xml.bind.annotation.XmlElement; |
| 18 | import javax.xml.bind.annotation.XmlType; |
| 19 | |
| 20 | |
| 21 | /** |
| 22 | * List of messages. |
| 23 | * |
| 24 | * <p>Java class for Messages complex type. |
| 25 | * |
| 26 | * <p>The following schema fragment specifies the expected content contained within this class. |
| 27 | * |
| 28 | * <pre> |
| 29 | * <complexType name="Messages"> |
| 30 | * <complexContent> |
| 31 | * <extension base="{http://jomc.org/model}ModelObject"> |
| 32 | * <sequence> |
| 33 | * <element ref="{http://jomc.org/model}message" maxOccurs="unbounded" minOccurs="0"/> |
| 34 | * <element name="reference" type="{http://jomc.org/model}MessageReference" maxOccurs="unbounded" minOccurs="0"/> |
| 35 | * </sequence> |
| 36 | * </extension> |
| 37 | * </complexContent> |
| 38 | * </complexType> |
| 39 | * </pre> |
| 40 | * |
| 41 | * |
| 42 | */ |
| 43 | @XmlAccessorType(XmlAccessType.FIELD) |
| 44 | @XmlType(name = "Messages", namespace = "http://jomc.org/model", propOrder = { |
| 45 | "message", |
| 46 | "reference" |
| 47 | }) |
| 48 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
| 49 | public class Messages |
| 50 | extends ModelObject |
| 51 | implements Cloneable |
| 52 | { |
| 53 | |
| 54 | @XmlElement(namespace = "http://jomc.org/model") |
| 55 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
| 56 | protected List<Message> message; |
| 57 | @XmlElement(namespace = "http://jomc.org/model") |
| 58 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
| 59 | protected List<MessageReference> reference; |
| 60 | |
| 61 | /** |
| 62 | * Creates a new {@code Messages} instance. |
| 63 | * |
| 64 | */ |
| 65 | public Messages() { |
| 66 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
| 67 | super(); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Creates a new {@code Messages} instance by deeply copying a given {@code Messages} instance. |
| 72 | * |
| 73 | * |
| 74 | * @param o |
| 75 | * The instance to copy. |
| 76 | * @throws NullPointerException |
| 77 | * if {@code o} is {@code null}. |
| 78 | */ |
| 79 | public Messages(final Messages o) { |
| 80 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
| 81 | super(o); |
| 82 | if (o == null) { |
| 83 | throw new NullPointerException("Cannot create a copy of 'Messages' from 'null'."); |
| 84 | } |
| 85 | // 'Message' collection. |
| 86 | if (o.message!= null) { |
| 87 | copyMessage(o.getMessage(), this.getMessage()); |
| 88 | } |
| 89 | // 'Reference' collection. |
| 90 | if (o.reference!= null) { |
| 91 | copyReference(o.getReference(), this.getReference()); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Gets the value of the message property. |
| 97 | * |
| 98 | * <p> |
| 99 | * This accessor method returns a reference to the live list, |
| 100 | * not a snapshot. Therefore any modification you make to the |
| 101 | * returned list will be present inside the JAXB object. |
| 102 | * This is why there is not a <CODE>set</CODE> method for the message property. |
| 103 | * |
| 104 | * <p> |
| 105 | * For example, to add a new item, do as follows: |
| 106 | * <pre> |
| 107 | * getMessage().add(newItem); |
| 108 | * </pre> |
| 109 | * |
| 110 | * |
| 111 | * <p> |
| 112 | * Objects of the following type(s) are allowed in the list |
| 113 | * {@link Message } |
| 114 | * |
| 115 | * |
| 116 | */ |
| 117 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
| 118 | public List<Message> getMessage() { |
| 119 | if (message == null) { |
| 120 | message = new ArrayList<Message>(); |
| 121 | } |
| 122 | return this.message; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Gets the value of the reference property. |
| 127 | * |
| 128 | * <p> |
| 129 | * This accessor method returns a reference to the live list, |
| 130 | * not a snapshot. Therefore any modification you make to the |
| 131 | * returned list will be present inside the JAXB object. |
| 132 | * This is why there is not a <CODE>set</CODE> method for the reference property. |
| 133 | * |
| 134 | * <p> |
| 135 | * For example, to add a new item, do as follows: |
| 136 | * <pre> |
| 137 | * getReference().add(newItem); |
| 138 | * </pre> |
| 139 | * |
| 140 | * |
| 141 | * <p> |
| 142 | * Objects of the following type(s) are allowed in the list |
| 143 | * {@link MessageReference } |
| 144 | * |
| 145 | * |
| 146 | */ |
| 147 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
| 148 | public List<MessageReference> getReference() { |
| 149 | if (reference == null) { |
| 150 | reference = new ArrayList<MessageReference>(); |
| 151 | } |
| 152 | return this.reference; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * Copies all values of property {@code Message} deeply. |
| 157 | * |
| 158 | * @param source |
| 159 | * The source to copy from. |
| 160 | * @param target |
| 161 | * The target to copy {@code source} to. |
| 162 | * @throws NullPointerException |
| 163 | * if {@code target} is {@code null}. |
| 164 | */ |
| 165 | @SuppressWarnings("unchecked") |
| 166 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
| 167 | private static void copyMessage(final List<Message> source, final List<Message> target) { |
| 168 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
| 169 | if ((source!= null)&&(!source.isEmpty())) { |
| 170 | for (final Iterator<?> it = source.iterator(); it.hasNext(); ) { |
| 171 | final Object next = it.next(); |
| 172 | if (next instanceof Message) { |
| 173 | // CClassInfo: org.jomc.model.Message |
| 174 | target.add(((Message) next).clone()); |
| 175 | continue; |
| 176 | } |
| 177 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 178 | throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Message' of class 'org.jomc.model.Messages'.")); |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Copies all values of property {@code Reference} deeply. |
| 185 | * |
| 186 | * @param source |
| 187 | * The source to copy from. |
| 188 | * @param target |
| 189 | * The target to copy {@code source} to. |
| 190 | * @throws NullPointerException |
| 191 | * if {@code target} is {@code null}. |
| 192 | */ |
| 193 | @SuppressWarnings("unchecked") |
| 194 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
| 195 | private static void copyReference(final List<MessageReference> source, final List<MessageReference> target) { |
| 196 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
| 197 | if ((source!= null)&&(!source.isEmpty())) { |
| 198 | for (final Iterator<?> it = source.iterator(); it.hasNext(); ) { |
| 199 | final Object next = it.next(); |
| 200 | if (next instanceof MessageReference) { |
| 201 | // CClassInfo: org.jomc.model.MessageReference |
| 202 | target.add(((MessageReference) next).clone()); |
| 203 | continue; |
| 204 | } |
| 205 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
| 206 | throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Reference' of class 'org.jomc.model.Messages'.")); |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Creates and returns a deep copy of this object. |
| 213 | * |
| 214 | * |
| 215 | * @return |
| 216 | * A deep copy of this object. |
| 217 | */ |
| 218 | @Override |
| 219 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-21T04:13:17+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") |
| 220 | public Messages clone() { |
| 221 | { |
| 222 | // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 |
| 223 | final Messages clone = ((Messages) super.clone()); |
| 224 | // 'Message' collection. |
| 225 | if (this.message!= null) { |
| 226 | clone.message = null; |
| 227 | copyMessage(this.getMessage(), clone.getMessage()); |
| 228 | } |
| 229 | // 'Reference' collection. |
| 230 | if (this.reference!= null) { |
| 231 | clone.reference = null; |
| 232 | copyReference(this.getReference(), clone.getReference()); |
| 233 | } |
| 234 | return clone; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * Gets a message for a given name from the list of messages. |
| 240 | * |
| 241 | * @param name The name of the message to return. |
| 242 | * |
| 243 | * @return The first matching message or {@code null}, if no such message is found. |
| 244 | * |
| 245 | * @throws NullPointerException if {@code name} is {@code null}. |
| 246 | * |
| 247 | * @see #getMessage() |
| 248 | * @see Message#getName() |
| 249 | */ |
| 250 | public Message getMessage( final String name ) |
| 251 | { |
| 252 | if ( name == null ) |
| 253 | { |
| 254 | throw new NullPointerException( "name" ); |
| 255 | } |
| 256 | |
| 257 | for ( int i = 0, s0 = this.getMessage().size(); i < s0; i++ ) |
| 258 | { |
| 259 | final Message m = this.getMessage().get( i ); |
| 260 | |
| 261 | if ( name.equals( m.getName() ) ) |
| 262 | { |
| 263 | return m; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | return null; |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | * Gets a message reference for a given name from the list of references. |
| 272 | * |
| 273 | * @param name The name of the message reference to return. |
| 274 | * |
| 275 | * @return The first matching message reference or {@code null}, if no such reference is found. |
| 276 | * |
| 277 | * @throws NullPointerException if {@code name} is {@code null}. |
| 278 | * |
| 279 | * @see #getReference() |
| 280 | * @see MessageReference#getName() |
| 281 | */ |
| 282 | public MessageReference getReference( final String name ) |
| 283 | { |
| 284 | if ( name == null ) |
| 285 | { |
| 286 | throw new NullPointerException( "name" ); |
| 287 | } |
| 288 | |
| 289 | for ( int i = 0, s0 = this.getReference().size(); i < s0; i++ ) |
| 290 | { |
| 291 | final MessageReference r = this.getReference().get( i ); |
| 292 | |
| 293 | if ( name.equals( r.getName() ) ) |
| 294 | { |
| 295 | return r; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | return null; |
| 300 | } |
| 301 | |
| 302 | } |