jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java
changeset 29839 6d5d546e953b
parent 28887 88470f768658
equal deleted inserted replaced
29838:fe5fd9871a13 29839:6d5d546e953b
    71  * <pre>
    71  * <pre>
    72  *     //Example: Code fragment corresponding to XML output
    72  *     //Example: Code fragment corresponding to XML output
    73  *     marshal( new Point(3,5), System.out);
    73  *     marshal( new Point(3,5), System.out);
    74  * </pre>
    74  * </pre>
    75  *
    75  *
    76  * <pre>
    76  * <pre>{@code
    77  *     &lt;!-- Example: XML output --&gt;
    77  *
    78  *     &lt;point&gt;
    78  *     <!-- Example: XML output -->
    79  *       &lt;x&gt; 3 &lt;/x&gt;
    79  *     <point>
    80  *       &lt;y&gt; 5 &lt;/y&gt;
    80  *       <x> 3 </x>
    81  *     &lt;/point&gt;
    81  *       <y> 5 </y>
    82  * </pre>
    82  *     </point>
       
    83  * }</pre>
    83  *
    84  *
    84  * The annotation causes an global element declaration to be produced
    85  * The annotation causes an global element declaration to be produced
    85  * in the schema. The global element declaration is associated with
    86  * in the schema. The global element declaration is associated with
    86  * the XML schema type to which the class is mapped.
    87  * the XML schema type to which the class is mapped.
    87  *
    88  *
    88  * <pre>
    89  * <pre>{@code
    89  *     &lt;!-- Example: XML schema definition --&gt;
    90  *
    90  *     &lt;xs:element name="point" type="point"/&gt;
    91  *     <!-- Example: XML schema definition -->
    91  *     &lt;xs:complexType name="point"&gt;
    92  *     <xs:element name="point" type="point"/>
    92  *       &lt;xs:sequence&gt;
    93  *     <xs:complexType name="point">
    93  *         &lt;xs:element name="x" type="xs:int"/&gt;
    94  *       <xs:sequence>
    94  *         &lt;xs:element name="y" type="xs:int"/&gt;
    95  *         <xs:element name="x" type="xs:int"/>
    95  *       &lt;/xs:sequence&gt;
    96  *         <xs:element name="y" type="xs:int"/>
    96  *     &lt;/xs:complexType&gt;
    97  *       </xs:sequence>
    97  * </pre>
    98  *     </xs:complexType>
       
    99  * }</pre>
    98  *
   100  *
    99  * <p>
   101  * <p>
   100  *
   102  *
   101  * <b>Example 2: Orthogonality to type inheritance </b>
   103  * <b>Example 2: Orthogonality to type inheritance </b>
   102  *
   104  *
   111  *         Point3D(int _x,int _y,int _z) {super(_x,_y);z=_z;}
   113  *         Point3D(int _x,int _y,int _z) {super(_x,_y);z=_z;}
   112  *     }
   114  *     }
   113  *
   115  *
   114  *     //Example: Code fragment corresponding to XML output *
   116  *     //Example: Code fragment corresponding to XML output *
   115  *     marshal( new Point3D(3,5,0), System.out );
   117  *     marshal( new Point3D(3,5,0), System.out );
       
   118  * {@code
   116  *
   119  *
   117  *     &lt;!-- Example: XML output --&gt;
   120  *     <!-- Example: XML output -->
   118  *     &lt;!-- The element name is point3D not point --&gt;
   121  *     <!-- The element name is point3D not point -->
   119  *     &lt;point3D&gt;
   122  *     <point3D>
   120  *       &lt;x&gt;3&lt;/x&gt;
   123  *       <x>3</x>
   121  *       &lt;y&gt;5&lt;/y&gt;
   124  *       <y>5</y>
   122  *       &lt;z&gt;0&lt;/z&gt;
   125  *       <z>0</z>
   123  *     &lt;/point3D&gt;
   126  *     </point3D>
   124  *
   127  *
   125  *     &lt;!-- Example: XML schema definition --&gt;
   128  *     <!-- Example: XML schema definition -->
   126  *     &lt;xs:element name="point3D" type="point3D"/&gt;
   129  *     <xs:element name="point3D" type="point3D"/>
   127  *     &lt;xs:complexType name="point3D"&gt;
   130  *     <xs:complexType name="point3D">
   128  *       &lt;xs:complexContent&gt;
   131  *       <xs:complexContent>
   129  *         &lt;xs:extension base="point"&gt;
   132  *         <xs:extension base="point">
   130  *           &lt;xs:sequence&gt;
   133  *           <xs:sequence>
   131  *             &lt;xs:element name="z" type="xs:int"/&gt;
   134  *             <xs:element name="z" type="xs:int"/>
   132  *           &lt;/xs:sequence&gt;
   135  *           </xs:sequence>
   133  *         &lt;/xs:extension&gt;
   136  *         </xs:extension>
   134  *       &lt;/xs:complexContent&gt;
   137  *       </xs:complexContent>
   135  *     &lt;/xs:complexType&gt;
   138  *     </xs:complexType>
   136  * </pre>
   139  * }</pre>
   137  *
   140  *
   138  * <b>Example 3: </b> Associate a global element with XML Schema type
   141  * <b>Example 3: </b> Associate a global element with XML Schema type
   139  * to which the class is mapped.
   142  * to which the class is mapped.
   140  * <pre>
   143  * <pre>
   141  *     //Example: Code fragment
   144  *     //Example: Code fragment
   142  *     &#64;XmlRootElement(name="PriceElement")
   145  *     &#64;XmlRootElement(name="PriceElement")
   143  *     public class USPrice {
   146  *     public class USPrice {
   144  *         &#64;XmlElement
   147  *         &#64;XmlElement
   145  *         public java.math.BigDecimal price;
   148  *         public java.math.BigDecimal price;
   146  *     }
   149  *     }
       
   150  * {@code
   147  *
   151  *
   148  *     &lt;!-- Example: XML schema definition --&gt;
   152  *     <!-- Example: XML schema definition -->
   149  *     &lt;xs:element name="PriceElement" type="USPrice"/&gt;
   153  *     <xs:element name="PriceElement" type="USPrice"/>
   150  *     &lt;xs:complexType name="USPrice"&gt;
   154  *     <xs:complexType name="USPrice">
   151  *       &lt;xs:sequence&gt;
   155  *       <xs:sequence>
   152  *         &lt;xs:element name="price" type="xs:decimal"/&gt;
   156  *         <xs:element name="price" type="xs:decimal"/>
   153  *       &lt;/sequence&gt;
   157  *       </sequence>
   154  *     &lt;/xs:complexType&gt;
   158  *     </xs:complexType>
   155  * </pre>
   159  * }</pre>
   156  *
   160  *
   157  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
   161  * @author Sekhar Vajjhala, Sun Microsystems, Inc.
   158  * @since 1.6, JAXB 2.0
   162  * @since 1.6, JAXB 2.0
   159  */
   163  */
   160 @Retention(RUNTIME)
   164 @Retention(RUNTIME)