src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRef.java

Print this page
rev 507 : 8047724: @since tag cleanup in jaxws
Reviewed-by:


 199  *         ...
 200  *     }
 201  * </pre>
 202  * <p>
 203  * Thus, the following code fragment
 204  * <pre>
 205  *     Math m = new Math();
 206  *     m.term = new ObjectFactory().createAdd(new Operator());
 207  *     marshal(m);
 208  * </pre>
 209  * will produce the following XML output:
 210  * <pre>
 211  *     &lt;math>
 212  *       &lt;add>...&lt;/add>
 213  *     &lt;/math>
 214  * </pre>
 215  *
 216  *
 217  * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems,Inc. </li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>
 218  * @see XmlElementRefs
 219  * @since JAXB2.0
 220  */
 221 @Retention(RUNTIME)
 222 @Target({FIELD,METHOD})
 223 public @interface XmlElementRef {
 224     /**
 225      * The Java type being referenced.
 226      * <p>
 227      * If the value is DEFAULT.class, the type is inferred from the
 228      * the type of the JavaBean property.
 229      */
 230     Class type() default DEFAULT.class;
 231 
 232     /**
 233      * This parameter and {@link #name()} are used to determine the
 234      * XML element for the JavaBean property.
 235      *
 236      * <p> If <tt>type()</tt> is <tt>JAXBElement.class</tt> , then
 237      * <tt>namespace()</tt> and <tt>name()</tt>
 238      * point to a factory method with {@link XmlElementDecl}. The XML
 239      * element name is the element name from the factory method's


 267     static final class DEFAULT {}
 268 
 269     /**
 270      * Customize the element declaration to be required.
 271      * <p>
 272      * If required() is true, then Javabean property is mapped to
 273      * an XML schema element declaration with minOccurs="1".
 274      * maxOccurs is "1" for a single valued property and "unbounded"
 275      * for a multivalued property.
 276      *
 277      * <p>
 278      * If required() is false, then the Javabean property is mapped
 279      * to XML Schema element declaration with minOccurs="0".
 280      * maxOccurs is "1" for a single valued property and "unbounded"
 281      * for a multivalued property.
 282      *
 283      * <p>
 284      * For compatibility with JAXB 2.1, this property defaults to <tt>true</tt>,
 285      * despite the fact that {@link XmlElement#required()} defaults to false.
 286      *
 287      * @since 2.2
 288      */
 289     boolean required() default true;
 290 }


 199  *         ...
 200  *     }
 201  * </pre>
 202  * <p>
 203  * Thus, the following code fragment
 204  * <pre>
 205  *     Math m = new Math();
 206  *     m.term = new ObjectFactory().createAdd(new Operator());
 207  *     marshal(m);
 208  * </pre>
 209  * will produce the following XML output:
 210  * <pre>
 211  *     &lt;math>
 212  *       &lt;add>...&lt;/add>
 213  *     &lt;/math>
 214  * </pre>
 215  *
 216  *
 217  * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems,Inc. </li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>
 218  * @see XmlElementRefs
 219  * @since 1.6, JAXB 2.0
 220  */
 221 @Retention(RUNTIME)
 222 @Target({FIELD,METHOD})
 223 public @interface XmlElementRef {
 224     /**
 225      * The Java type being referenced.
 226      * <p>
 227      * If the value is DEFAULT.class, the type is inferred from the
 228      * the type of the JavaBean property.
 229      */
 230     Class type() default DEFAULT.class;
 231 
 232     /**
 233      * This parameter and {@link #name()} are used to determine the
 234      * XML element for the JavaBean property.
 235      *
 236      * <p> If <tt>type()</tt> is <tt>JAXBElement.class</tt> , then
 237      * <tt>namespace()</tt> and <tt>name()</tt>
 238      * point to a factory method with {@link XmlElementDecl}. The XML
 239      * element name is the element name from the factory method's


 267     static final class DEFAULT {}
 268 
 269     /**
 270      * Customize the element declaration to be required.
 271      * <p>
 272      * If required() is true, then Javabean property is mapped to
 273      * an XML schema element declaration with minOccurs="1".
 274      * maxOccurs is "1" for a single valued property and "unbounded"
 275      * for a multivalued property.
 276      *
 277      * <p>
 278      * If required() is false, then the Javabean property is mapped
 279      * to XML Schema element declaration with minOccurs="0".
 280      * maxOccurs is "1" for a single valued property and "unbounded"
 281      * for a multivalued property.
 282      *
 283      * <p>
 284      * For compatibility with JAXB 2.1, this property defaults to <tt>true</tt>,
 285      * despite the fact that {@link XmlElement#required()} defaults to false.
 286      *
 287      * @since 1.7, JAXB 2.2
 288      */
 289     boolean required() default true;
 290 }