< prev index next >

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

Print this page




  44  *      int[] names;
  45  *
  46  *    // XML Serialization Form 1 (Unwrapped collection)
  47  *    <names> ... </names>
  48  *    <names> ... </names>
  49  *
  50  *    // XML Serialization Form 2 ( Wrapped collection )
  51  *    <wrapperElement>
  52  *       <names> value-of-item </names>
  53  *       <names> value-of-item </names>
  54  *       ....
  55  *    </wrapperElement>
  56  * }</pre>
  57  *
  58  * <p> The two serialized XML forms allow a null collection to be
  59  * represented either by absence or presence of an element with a
  60  * nillable attribute.
  61  *
  62  * <p> <b>Usage</b> </p>
  63  * <p>
  64  * The <tt>@XmlElementWrapper</tt> annotation can be used with the
  65  * following program elements:
  66  * <ul>
  67  *   <li> JavaBean property </li>
  68  *   <li> non static, non transient field </li>
  69  * </ul>
  70  *
  71  * <p>The usage is subject to the following constraints:
  72  * <ul>
  73  *   <li> The property must be a collection property </li>
  74  *   <li> This annotation can be used with the following annotations:
  75  *            {@link XmlElement},
  76  *            {@link XmlElements},
  77  *            {@link XmlElementRef},
  78  *            {@link XmlElementRefs},
  79  *            {@link XmlJavaTypeAdapter}.</li>
  80  * </ul>
  81  *
  82  * <p>See "Package Specification" in javax.xml.bind.package javadoc for
  83  * additional common information.</p>
  84  *


 103      * XML target namespace of the XML wrapper element.
 104      * <p>
 105      * If the value is "##default", then the namespace is determined
 106      * as follows:
 107      * <ol>
 108      *  <li>
 109      *  If the enclosing package has {@link XmlSchema} annotation,
 110      *  and its {@link XmlSchema#elementFormDefault() elementFormDefault}
 111      *  is {@link XmlNsForm#QUALIFIED QUALIFIED}, then the namespace of
 112      *  the enclosing class.
 113      *
 114      *  <li>
 115      *  Otherwise "" (which produces unqualified element in the default
 116      *  namespace.
 117      * </ol>
 118      */
 119     String namespace() default "##default";
 120 
 121     /**
 122      * If true, the absence of the collection is represented by
 123      * using <tt>xsi:nil='true'</tt>. Otherwise, it is represented by
 124      * the absence of the element.
 125      */
 126     boolean nillable() default false;
 127 
 128     /**
 129      * Customize the wrapper element declaration to be required.
 130      *
 131      * <p>
 132      * If required() is true, then the corresponding generated
 133      * XML schema element declaration will have <tt>minOccurs="1"</tt>,
 134      * to indicate that the wrapper element is always expected.
 135      *
 136      * <p>
 137      * Note that this only affects the schema generation, and
 138      * not the unmarshalling or marshalling capability. This is
 139      * simply a mechanism to let users express their application constraints
 140      * better.
 141      *
 142      * @since 1.6, JAXB 2.1
 143      */
 144     boolean required() default false;
 145 }


  44  *      int[] names;
  45  *
  46  *    // XML Serialization Form 1 (Unwrapped collection)
  47  *    <names> ... </names>
  48  *    <names> ... </names>
  49  *
  50  *    // XML Serialization Form 2 ( Wrapped collection )
  51  *    <wrapperElement>
  52  *       <names> value-of-item </names>
  53  *       <names> value-of-item </names>
  54  *       ....
  55  *    </wrapperElement>
  56  * }</pre>
  57  *
  58  * <p> The two serialized XML forms allow a null collection to be
  59  * represented either by absence or presence of an element with a
  60  * nillable attribute.
  61  *
  62  * <p> <b>Usage</b> </p>
  63  * <p>
  64  * The {@code @XmlElementWrapper} annotation can be used with the
  65  * following program elements:
  66  * <ul>
  67  *   <li> JavaBean property </li>
  68  *   <li> non static, non transient field </li>
  69  * </ul>
  70  *
  71  * <p>The usage is subject to the following constraints:
  72  * <ul>
  73  *   <li> The property must be a collection property </li>
  74  *   <li> This annotation can be used with the following annotations:
  75  *            {@link XmlElement},
  76  *            {@link XmlElements},
  77  *            {@link XmlElementRef},
  78  *            {@link XmlElementRefs},
  79  *            {@link XmlJavaTypeAdapter}.</li>
  80  * </ul>
  81  *
  82  * <p>See "Package Specification" in javax.xml.bind.package javadoc for
  83  * additional common information.</p>
  84  *


 103      * XML target namespace of the XML wrapper element.
 104      * <p>
 105      * If the value is "##default", then the namespace is determined
 106      * as follows:
 107      * <ol>
 108      *  <li>
 109      *  If the enclosing package has {@link XmlSchema} annotation,
 110      *  and its {@link XmlSchema#elementFormDefault() elementFormDefault}
 111      *  is {@link XmlNsForm#QUALIFIED QUALIFIED}, then the namespace of
 112      *  the enclosing class.
 113      *
 114      *  <li>
 115      *  Otherwise "" (which produces unqualified element in the default
 116      *  namespace.
 117      * </ol>
 118      */
 119     String namespace() default "##default";
 120 
 121     /**
 122      * If true, the absence of the collection is represented by
 123      * using {@code xsi:nil='true'}. Otherwise, it is represented by
 124      * the absence of the element.
 125      */
 126     boolean nillable() default false;
 127 
 128     /**
 129      * Customize the wrapper element declaration to be required.
 130      *
 131      * <p>
 132      * If required() is true, then the corresponding generated
 133      * XML schema element declaration will have {@code minOccurs="1"},
 134      * to indicate that the wrapper element is always expected.
 135      *
 136      * <p>
 137      * Note that this only affects the schema generation, and
 138      * not the unmarshalling or marshalling capability. This is
 139      * simply a mechanism to let users express their application constraints
 140      * better.
 141      *
 142      * @since 1.6, JAXB 2.1
 143      */
 144     boolean required() default false;
 145 }
< prev index next >