< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java

Print this page




  27 
  28 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  29 import static java.lang.annotation.RetentionPolicy.RUNTIME;
  30 import static java.lang.annotation.ElementType.FIELD;
  31 import static java.lang.annotation.ElementType.METHOD;
  32 import java.lang.annotation.Retention;
  33 import java.lang.annotation.Target;
  34 
  35 /**
  36  * <p>
  37  * A container for multiple @{@link XmlElement} annotations.
  38  *
  39  * Multiple annotations of the same type are not allowed on a program
  40  * element. This annotation therefore serves as a container annotation
  41  * for multiple @XmlElements as follows:
  42  *
  43  * <pre>
  44  * @XmlElements({ @XmlElement(...),@XmlElement(...) })
  45  * </pre>
  46  *
  47  * <p>The <tt>@XmlElements</tt> annotation can be used with the
  48  * following program elements: </p>
  49  * <ul>
  50  *   <li> a JavaBean property </li>
  51  *   <li> non static, non transient field </li>
  52  * </ul>
  53  *
  54  * This annotation is intended for annotation a JavaBean collection
  55  * property (e.g. List).
  56  *
  57  * <p><b>Usage</b></p>
  58  *
  59  * <p>The usage is subject to the following constraints:
  60  * <ul>
  61  *   <li> This annotation can be used with the following
  62  *        annotations: @{@link XmlIDREF}, @{@link XmlElementWrapper}. </li>
  63  *   <li> If @XmlIDREF is also specified on the JavaBean property,
  64  *        then each @XmlElement.type() must contain a JavaBean
  65  *        property annotated with <tt>@XmlID</tt>.</li>
  66  * </ul>
  67  *
  68  * <p>See "Package Specification" in javax.xml.bind.package javadoc for
  69  * additional common information.</p>
  70  *
  71  * <hr>
  72  *
  73  * <p><b>Example 1:</b> Map to a list of elements</p>
  74  * <pre>
  75  *
  76  *    // Mapped code fragment
  77  *    public class Foo {
  78  *        @XmlElements(
  79  *            @XmlElement(name="A", type=Integer.class),
  80  *            @XmlElement(name="B", type=Float.class)
  81  *         )
  82  *         public List items;
  83  *    }
  84  * {@code
  85  *




  27 
  28 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  29 import static java.lang.annotation.RetentionPolicy.RUNTIME;
  30 import static java.lang.annotation.ElementType.FIELD;
  31 import static java.lang.annotation.ElementType.METHOD;
  32 import java.lang.annotation.Retention;
  33 import java.lang.annotation.Target;
  34 
  35 /**
  36  * <p>
  37  * A container for multiple @{@link XmlElement} annotations.
  38  *
  39  * Multiple annotations of the same type are not allowed on a program
  40  * element. This annotation therefore serves as a container annotation
  41  * for multiple @XmlElements as follows:
  42  *
  43  * <pre>
  44  * @XmlElements({ @XmlElement(...),@XmlElement(...) })
  45  * </pre>
  46  *
  47  * <p>The {@code @XmlElements} annotation can be used with the
  48  * following program elements: </p>
  49  * <ul>
  50  *   <li> a JavaBean property </li>
  51  *   <li> non static, non transient field </li>
  52  * </ul>
  53  *
  54  * This annotation is intended for annotation a JavaBean collection
  55  * property (e.g. List).
  56  *
  57  * <p><b>Usage</b></p>
  58  *
  59  * <p>The usage is subject to the following constraints:
  60  * <ul>
  61  *   <li> This annotation can be used with the following
  62  *        annotations: @{@link XmlIDREF}, @{@link XmlElementWrapper}. </li>
  63  *   <li> If @XmlIDREF is also specified on the JavaBean property,
  64  *        then each @XmlElement.type() must contain a JavaBean
  65  *        property annotated with {@code @XmlID}.</li>
  66  * </ul>
  67  *
  68  * <p>See "Package Specification" in javax.xml.bind.package javadoc for
  69  * additional common information.</p>
  70  *
  71  * <hr>
  72  *
  73  * <p><b>Example 1:</b> Map to a list of elements</p>
  74  * <pre>
  75  *
  76  *    // Mapped code fragment
  77  *    public class Foo {
  78  *        @XmlElements(
  79  *            @XmlElement(name="A", type=Integer.class),
  80  *            @XmlElement(name="B", type=Float.class)
  81  *         )
  82  *         public List items;
  83  *    }
  84  * {@code
  85  *


< prev index next >