jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java
changeset 29839 6d5d546e953b
parent 28887 88470f768658
child 32795 5a5710ee05a0
equal deleted inserted replaced
29838:fe5fd9871a13 29839:6d5d546e953b
   110  * see @{@link XmlValue} annotation type.
   110  * see @{@link XmlValue} annotation type.
   111  * <p>
   111  * <p>
   112  * The following table shows the mapping of the class to a XML Schema
   112  * The following table shows the mapping of the class to a XML Schema
   113  * complex type or simple type. The notational symbols used in the table are:
   113  * complex type or simple type. The notational symbols used in the table are:
   114  * <ul>
   114  * <ul>
   115  *   <li> -&gt;    : represents a mapping </li>
   115  *   <li> {@literal ->}    : represents a mapping </li>
   116  *   <li> [x]+  : one or more occurances of x </li>
   116  *   <li> [x]+  : one or more occurances of x </li>
   117  *   <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with
   117  *   <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with
   118  *         <tt>@XmlValue</tt></li>
   118  *         <tt>@XmlValue</tt></li>
   119  *   <li> X     : don't care
   119  *   <li> X     : don't care
   120  * </ul>
   120  * </ul>
   130  *       </tr>
   130  *       </tr>
   131  *
   131  *
   132  *       <tr valign="top">
   132  *       <tr valign="top">
   133  *         <td>Class</td>
   133  *         <td>Class</td>
   134  *         <td>{}</td>
   134  *         <td>{}</td>
   135  *         <td>[property]+ -&gt; elements</td>
   135  *         <td>[property]+ {@literal ->} elements</td>
   136  *         <td>complexcontent<br>xs:all</td>
   136  *         <td>complexcontent<br>xs:all</td>
   137  *         <td> </td>
   137  *         <td> </td>
   138  *       </tr>
   138  *       </tr>
   139  *
   139  *
   140  *       <tr valign="top">
   140  *       <tr valign="top">
   141  *         <td>Class</td>
   141  *         <td>Class</td>
   142  *         <td>non empty</td>
   142  *         <td>non empty</td>
   143  *         <td>[property]+ -&gt; elements</td>
   143  *         <td>[property]+ {@literal ->} elements</td>
   144  *         <td>complexcontent<br>xs:sequence</td>
   144  *         <td>complexcontent<br>xs:sequence</td>
   145  *         <td> </td>
   145  *         <td> </td>
   146  *       </tr>
   146  *       </tr>
   147  *
   147  *
   148  *       <tr valign="top">
   148  *       <tr valign="top">
   149  *         <td>Class</td>
   149  *         <td>Class</td>
   150  *         <td>X</td>
   150  *         <td>X</td>
   151  *         <td>no property -&gt; element</td>
   151  *         <td>no property {@literal ->} element</td>
   152  *         <td>complexcontent<br>empty sequence</td>
   152  *         <td>complexcontent<br>empty sequence</td>
   153  *         <td> </td>
   153  *         <td> </td>
   154  *       </tr>
   154  *       </tr>
   155  *
   155  *
   156  *       <tr valign="top">
   156  *       <tr valign="top">
   157  *         <td>Class</td>
   157  *         <td>Class</td>
   158  *         <td>X</td>
   158  *         <td>X</td>
   159  *         <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ -&gt; attributes</td>
   159  *         <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ {@literal ->} attributes</td>
   160  *         <td>simplecontent</td>
   160  *         <td>simplecontent</td>
   161  *         <td> </td>
   161  *         <td> </td>
   162  *       </tr>
   162  *       </tr>
   163  *
   163  *
   164  *       <tr valign="top">
   164  *       <tr valign="top">
   165  *         <td>Class</td>
   165  *         <td>Class</td>
   166  *         <td>X</td>
   166  *         <td>X</td>
   167  *         <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties -&gt; attribute</td>
   167  *         <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties {@literal ->} attribute</td>
   168  *         <td> </td>
   168  *         <td> </td>
   169  *         <td>simpletype</td>
   169  *         <td>simpletype</td>
   170  *       </tr>
   170  *       </tr>
   171  *     </tbody>
   171  *     </tbody>
   172  *   </table>
   172  *   </table>
   206  *     void setState(String) {..};
   206  *     void setState(String) {..};
   207  *
   207  *
   208  *     java.math.BigDecimal getZip() {..};
   208  *     java.math.BigDecimal getZip() {..};
   209  *     void setZip(java.math.BigDecimal) {..};
   209  *     void setZip(java.math.BigDecimal) {..};
   210  *   }
   210  *   }
   211  *
   211  * {@code
   212  *   &lt;!-- XML Schema mapping for USAddress --&gt;
   212  *
   213  *   &lt;xs:complexType name="USAddress"&gt;
   213  *   <!-- XML Schema mapping for USAddress -->
   214  *     &lt;xs:sequence&gt;
   214  *   <xs:complexType name="USAddress">
   215  *       &lt;xs:element name="street" type="xs:string"/&gt;
   215  *     <xs:sequence>
   216  *       &lt;xs:element name="city" type="xs:string"/&gt;
   216  *       <xs:element name="street" type="xs:string"/>
   217  *       &lt;xs:element name="state" type="xs:string"/&gt;
   217  *       <xs:element name="city" type="xs:string"/>
   218  *       &lt;xs:element name="zip" type="xs:decimal"/&gt;
   218  *       <xs:element name="state" type="xs:string"/>
   219  *       &lt;xs:element name="name" type="xs:string"/&gt;
   219  *       <xs:element name="zip" type="xs:decimal"/>
   220  *     &lt;/xs:all&gt;
   220  *       <xs:element name="name" type="xs:string"/>
   221  *   &lt;/xs:complexType&gt;
   221  *     </xs:all>
   222  * </pre>
   222  *   </xs:complexType>
       
   223  * }</pre>
   223  * <p> <b> Example 2: </b> Map a class to a complex type with
   224  * <p> <b> Example 2: </b> Map a class to a complex type with
   224  *     xs:all </p>
   225  *     xs:all </p>
   225  * <pre>
   226  * <pre>
   226  * &#64;XmlType(propOrder={})
   227  * &#64;XmlType(propOrder={})
   227  * public class USAddress { ...}
   228  * public class USAddress { ...}
   228  *
   229  * {@code
   229  * &lt;!-- XML Schema mapping for USAddress --&gt;
   230  *
   230  * &lt;xs:complexType name="USAddress"&gt;
   231  * <!-- XML Schema mapping for USAddress -->
   231  *   &lt;xs:all&gt;
   232  * <xs:complexType name="USAddress">
   232  *     &lt;xs:element name="name" type="xs:string"/&gt;
   233  *   <xs:all>
   233  *     &lt;xs:element name="street" type="xs:string"/&gt;
   234  *     <xs:element name="name" type="xs:string"/>
   234  *     &lt;xs:element name="city" type="xs:string"/&gt;
   235  *     <xs:element name="street" type="xs:string"/>
   235  *     &lt;xs:element name="state" type="xs:string"/&gt;
   236  *     <xs:element name="city" type="xs:string"/>
   236  *     &lt;xs:element name="zip" type="xs:decimal"/&gt;
   237  *     <xs:element name="state" type="xs:string"/>
   237  *   &lt;/xs:sequence&gt;
   238  *     <xs:element name="zip" type="xs:decimal"/>
   238  * &lt;/xs:complexType&gt;
   239  *   </xs:sequence>
   239  *</pre>
   240  * </xs:complexType>
       
   241  *}</pre>
   240  * <p> <b> Example 3: </b> Map a class to a global element with an
   242  * <p> <b> Example 3: </b> Map a class to a global element with an
   241  * anonymous type.
   243  * anonymous type.
   242  * </p>
   244  * </p>
   243  * <pre>
   245  * <pre>
   244  *   &#64;XmlRootElement
   246  *   &#64;XmlRootElement
   245  *   &#64;XmlType(name="")
   247  *   &#64;XmlType(name="")
   246  *   public class USAddress { ...}
   248  *   public class USAddress { ...}
   247  *
   249  * {@code
   248  *   &lt;!-- XML Schema mapping for USAddress --&gt;
   250  *
   249  *   &lt;xs:element name="USAddress"&gt;
   251  *   <!-- XML Schema mapping for USAddress -->
   250  *     &lt;xs:complexType&gt;
   252  *   <xs:element name="USAddress">
   251  *       &lt;xs:sequence&gt;
   253  *     <xs:complexType>
   252  *         &lt;xs:element name="name" type="xs:string"/&gt;
   254  *       <xs:sequence>
   253  *         &lt;xs:element name="street" type="xs:string"/&gt;
   255  *         <xs:element name="name" type="xs:string"/>
   254  *         &lt;xs:element name="city" type="xs:string"/&gt;
   256  *         <xs:element name="street" type="xs:string"/>
   255  *         &lt;xs:element name="state" type="xs:string"/&gt;
   257  *         <xs:element name="city" type="xs:string"/>
   256  *         &lt;xs:element name="zip" type="xs:decimal"/&gt;
   258  *         <xs:element name="state" type="xs:string"/>
   257  *       &lt;/xs:sequence&gt;
   259  *         <xs:element name="zip" type="xs:decimal"/>
   258  *     &lt;/xs:complexType&gt;
   260  *       </xs:sequence>
   259  *   &lt;/xs:element&gt;
   261  *     </xs:complexType>
   260  * </pre>
   262  *   </xs:element>
       
   263  * }</pre>
   261  *
   264  *
   262  * <p> <b> Example 4: </b> Map a property to a local element with
   265  * <p> <b> Example 4: </b> Map a property to a local element with
   263  * anonymous type.
   266  * anonymous type.
   264  * <pre>
   267  * <pre>
   265  *   //Example: Code fragment
   268  *   //Example: Code fragment
   269  *       }
   272  *       }
   270  *
   273  *
   271  *   &#64;XmlType(name="")
   274  *   &#64;XmlType(name="")
   272  *   public class USAddress { ... }
   275  *   public class USAddress { ... }
   273  *   }
   276  *   }
   274  *
   277  * {@code
   275  *   &lt;!-- XML Schema mapping for USAddress --&gt;
   278  *
   276  *   &lt;xs:complexType name="Invoice"&gt;
   279  *   <!-- XML Schema mapping for USAddress -->
   277  *     &lt;xs:sequence&gt;
   280  *   <xs:complexType name="Invoice">
   278  *       &lt;xs:element name="addr"&gt;
   281  *     <xs:sequence>
   279  *         &lt;xs:complexType&gt;
   282  *       <xs:element name="addr">
   280  *           &lt;xs:element name="name", type="xs:string"/&gt;
   283  *         <xs:complexType>
   281  *           &lt;xs:element name="city", type="xs:string"/&gt;
   284  *           <xs:element name="name", type="xs:string"/>
   282  *           &lt;xs:element name="city" type="xs:string"/&gt;
   285  *           <xs:element name="city", type="xs:string"/>
   283  *           &lt;xs:element name="state" type="xs:string"/&gt;
   286  *           <xs:element name="city" type="xs:string"/>
   284  *           &lt;xs:element name="zip" type="xs:decimal"/&gt;
   287  *           <xs:element name="state" type="xs:string"/>
   285  *         &lt;/xs:complexType&gt;
   288  *           <xs:element name="zip" type="xs:decimal"/>
       
   289  *         </xs:complexType>
   286  *       ...
   290  *       ...
   287  *     &lt;/xs:sequence&gt;
   291  *     </xs:sequence>
   288  *   &lt;/xs:complexType&gt;
   292  *   </xs:complexType>
   289  * </pre>
   293  * }</pre>
   290  *
   294  *
   291  * <p> <b> Example 5: </b> Map a property to an attribute with
   295  * <p> <b> Example 5: </b> Map a property to an attribute with
   292  * anonymous type.
   296  * anonymous type.
   293  *
   297  *
   294  * <pre>
   298  * <pre>
   304  *     &#64;XmlType(name="")
   308  *     &#64;XmlType(name="")
   305  *     public class USPrice {
   309  *     public class USPrice {
   306  *         &#64;XmlValue
   310  *         &#64;XmlValue
   307  *         public java.math.BigDecimal price;
   311  *         public java.math.BigDecimal price;
   308  *     }
   312  *     }
   309  *
   313  * {@code
   310  *     &lt;!-- Example: XML Schema fragment --&gt;
   314  *
   311  *     &lt;xs:complexType name="Item"&gt;
   315  *     <!-- Example: XML Schema fragment -->
   312  *       &lt;xs:sequence&gt;
   316  *     <xs:complexType name="Item">
   313  *         &lt;xs:element name="name" type="xs:string"/&gt;
   317  *       <xs:sequence>
   314  *         &lt;xs:attribute name="price"&gt;
   318  *         <xs:element name="name" type="xs:string"/>
   315  *           &lt;xs:simpleType&gt;
   319  *         <xs:attribute name="price">
   316  *             &lt;xs:restriction base="xs:decimal"/&gt;
   320  *           <xs:simpleType>
   317  *           &lt;/xs:simpleType&gt;
   321  *             <xs:restriction base="xs:decimal"/>
   318  *         &lt;/xs:attribute&gt;
   322  *           </xs:simpleType>
   319  *       &lt;/xs:sequence&gt;
   323  *         </xs:attribute>
   320  *     &lt;/xs:complexType&gt;
   324  *       </xs:sequence>
   321  * </pre>
   325  *     </xs:complexType>
       
   326  * }</pre>
   322  *
   327  *
   323  *  <p> <b> Example 6: </b> Define a factoryClass and factoryMethod
   328  *  <p> <b> Example 6: </b> Define a factoryClass and factoryMethod
   324  *
   329  *
   325  * <pre>
   330  * <pre>
   326  *      &#64;XmlType(name="USAddressType", factoryClass=USAddressFactory.class,
   331  *      &#64;XmlType(name="USAddressType", factoryClass=USAddressFactory.class,