XmlI18nString.java
package dev.orne.i18n.jaxb;
/*-
 * #%L
 * Orne I18N
 * %%
 * Copyright (C) 2021 Orne Developments
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
 * #L%
 */
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlMixed;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apiguardian.api.API;
import org.apiguardian.api.API.Status;
import dev.orne.i18n.I18nString;
import dev.orne.i18n.I18nXmlSchema;
/**
 * XML representation of I18N string.
 * <p>
 * This class is based on class generated by JAXB Reference Implementation
 * v2.3.2, but modified to correct deficiencies caused by
 * <a href="https://github.com/eclipse-ee4j/jaxb-ri/issues/1108">Issue 1108</a>.
 * <p>The following schema fragment specifies the expected content contained
 * within this class.
 * <pre>
 * <complexType name="string">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{http://orne.dev/i18n/}translation" maxOccurs="unbounded"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * </pre>
 * 
 * @author <a href="https://github.com/ihernaez">(w) Iker Hernaez</a>
 * @version 1.0, 2021-02
 * @see I18nString
 * @see <a href="https://github.com/eclipse-ee4j/jaxb-ri/issues/1108">JAXB RI Issue 1108</a>
 * @since 0.1
 */
@API(status=Status.INTERNAL, since="0.1")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(
        name=I18nXmlSchema.STRING_TYPE,
        namespace=I18nXmlSchema.NS,
        propOrder={
            "content"
        })
@XmlRootElement(
        name=I18nXmlSchema.STRING_ELEMENT,
        namespace=I18nXmlSchema.NS)
public class XmlI18nString
implements Serializable {
    /** The serial version UID. */
    private static final long serialVersionUID = 1L;
    /** The contents of the I18N string. */
    @XmlElementRef(
            name=I18nXmlSchema.TRANSLATION_ELEMENT,
            namespace=I18nXmlSchema.NS,
            type=XmlI18nStringTranslation.class)
    @XmlMixed
    private List<Serializable> content;
    /**
     * Creates a new instance.
     */
    public XmlI18nString() {
        super();
    }
    /**
     * Gets the contents of the I18N string.
     * <p>
     * This accessor method returns a reference to the live list, not a
     * snapshot. Therefore any modification you make to the returned list will
     * be present inside the JAXB object. This is why there is not a
     * {@code set} method for the content property.
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getContent().add(newItem);
     * </pre>
     * <p>
     * Objects of the following type(s) are allowed in the list:
     * <ul>
     * <li>{@link XmlI18nStringTranslation}</li>
     * <li>{@link String}</li>
     * </ul>
     * 
     * @return The contents of the I18N string
     */
    public List<Serializable> getContent() {
        if (this.content == null) {
            this.content = new ArrayList<>();
        }
        return this.content;
    }
}