< prev index next >
src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 62,72 ****
* A class maps to either a XML Schema complex type or a XML Schema simple
* type. The XML Schema type is derived based on the
* mapping of JavaBean properties and fields contained within the
* class. The schema type to which the class is mapped can either be
* named or anonymous. A class can be mapped to an anonymous schema
! * type by annotating the class with <tt>@XmlType(name="")</tt>.
* <p>
* Either a global element, local element or a local attribute can be
* associated with an anonymous type as follows:
* <ul>
* <li><b>global element: </b> A global element of an anonymous
--- 62,72 ----
* A class maps to either a XML Schema complex type or a XML Schema simple
* type. The XML Schema type is derived based on the
* mapping of JavaBean properties and fields contained within the
* class. The schema type to which the class is mapped can either be
* named or anonymous. A class can be mapped to an anonymous schema
! * type by annotating the class with <tt>@XmlType(name="")</tt>.
* <p>
* Either a global element, local element or a local attribute can be
* associated with an anonymous type as follows:
* <ul>
* <li><b>global element: </b> A global element of an anonymous
*** 110,127 ****
* see @{@link XmlValue} annotation type.
* <p>
* The following table shows the mapping of the class to a XML Schema
* complex type or simple type. The notational symbols used in the table are:
* <ul>
! * <li> -> : represents a mapping </li>
* <li> [x]+ : one or more occurances of x </li>
* <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with
* <tt>@XmlValue</tt></li>
* <li> X : don't care
* </ul>
* <blockquote>
! * <table border="1" cellpadding="4" cellspacing="3">
* <tbody>
* <tr>
* <td><b>Target</b></td>
* <td><b>propOrder</b></td>
* <td><b>ClassBody</b></td>
--- 110,127 ----
* see @{@link XmlValue} annotation type.
* <p>
* The following table shows the mapping of the class to a XML Schema
* complex type or simple type. The notational symbols used in the table are:
* <ul>
! * <li> -> : represents a mapping </li>
* <li> [x]+ : one or more occurances of x </li>
* <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with
* <tt>@XmlValue</tt></li>
* <li> X : don't care
* </ul>
* <blockquote>
! * <table summary="" border="1" cellpadding="4" cellspacing="3">
* <tbody>
* <tr>
* <td><b>Target</b></td>
* <td><b>propOrder</b></td>
* <td><b>ClassBody</b></td>
*** 130,177 ****
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>{}</td>
! * <td>[property]+ -> elements</td>
* <td>complexcontent<br>xs:all</td>
* <td> </td>
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>non empty</td>
! * <td>[property]+ -> elements</td>
* <td>complexcontent<br>xs:sequence</td>
* <td> </td>
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
! * <td>no property -> element</td>
* <td>complexcontent<br>empty sequence</td>
* <td> </td>
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
! * <td>1 [ <tt>@XmlValue</tt> property] && <br> [property]+
! * ->attributes</td>
* <td>simplecontent</td>
* <td> </td>
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
! * <td>1 [ <tt>@XmlValue</tt> property ]&& <br> no properties
! * -> attribute</td>
* <td> </td>
* <td>simpletype</td>
- * <td> </td>
* </tr>
* </tbody>
* </table>
* </blockquote>
*
--- 130,174 ----
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>{}</td>
! * <td>[property]+ -> elements</td>
* <td>complexcontent<br>xs:all</td>
* <td> </td>
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>non empty</td>
! * <td>[property]+ -> elements</td>
* <td>complexcontent<br>xs:sequence</td>
* <td> </td>
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
! * <td>no property -> element</td>
* <td>complexcontent<br>empty sequence</td>
* <td> </td>
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
! * <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ -> attributes</td>
* <td>simplecontent</td>
* <td> </td>
* </tr>
*
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
! * <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties -> attribute</td>
* <td> </td>
* <td>simpletype</td>
* </tr>
* </tbody>
* </table>
* </blockquote>
*
*** 210,271 ****
*
* java.math.BigDecimal getZip() {..};
* void setZip(java.math.BigDecimal) {..};
* }
*
! * <!-- XML Schema mapping for USAddress -->
! * <xs:complexType name="USAddress">
! * <xs:sequence>
! * <xs:element name="street" type="xs:string"/>
! * <xs:element name="city" type="xs:string"/>
! * <xs:element name="state" type="xs:string"/>
! * <xs:element name="zip" type="xs:decimal"/>
! * <xs:element name="name" type="xs:string"/>
! * </xs:all>
! * </xs:complexType>
* </pre>
* <p> <b> Example 2: </b> Map a class to a complex type with
* xs:all </p>
* <pre>
* @XmlType(propOrder={})
* public class USAddress { ...}
*
! * <!-- XML Schema mapping for USAddress -->
! * <xs:complexType name="USAddress">
! * <xs:all>
! * <xs:element name="name" type="xs:string"/>
! * <xs:element name="street" type="xs:string"/>
! * <xs:element name="city" type="xs:string"/>
! * <xs:element name="state" type="xs:string"/>
! * <xs:element name="zip" type="xs:decimal"/>
! * </xs:sequence>
! * </xs:complexType>
*</pre>
* <p> <b> Example 3: </b> Map a class to a global element with an
* anonymous type.
* </p>
* <pre>
* @XmlRootElement
* @XmlType(name="")
* public class USAddress { ...}
*
! * <!-- XML Schema mapping for USAddress -->
! * <xs:element name="USAddress">
! * <xs:complexType>
! * <xs:sequence>
! * <xs:element name="name" type="xs:string"/>
! * <xs:element name="street" type="xs:string"/>
! * <xs:element name="city" type="xs:string"/>
! * <xs:element name="state" type="xs:string"/>
! * <xs:element name="zip" type="xs:decimal"/>
! * </xs:sequence>
! * </xs:complexType>
! * </xs:element>
* </pre>
*
* <p> <b> Example 4: </b> Map a property to a local element with
! * anonmyous type.
* <pre>
* //Example: Code fragment
* public class Invoice {
* USAddress addr;
* ...
--- 207,268 ----
*
* java.math.BigDecimal getZip() {..};
* void setZip(java.math.BigDecimal) {..};
* }
*
! * <!-- XML Schema mapping for USAddress -->
! * <xs:complexType name="USAddress">
! * <xs:sequence>
! * <xs:element name="street" type="xs:string"/>
! * <xs:element name="city" type="xs:string"/>
! * <xs:element name="state" type="xs:string"/>
! * <xs:element name="zip" type="xs:decimal"/>
! * <xs:element name="name" type="xs:string"/>
! * </xs:all>
! * </xs:complexType>
* </pre>
* <p> <b> Example 2: </b> Map a class to a complex type with
* xs:all </p>
* <pre>
* @XmlType(propOrder={})
* public class USAddress { ...}
*
! * <!-- XML Schema mapping for USAddress -->
! * <xs:complexType name="USAddress">
! * <xs:all>
! * <xs:element name="name" type="xs:string"/>
! * <xs:element name="street" type="xs:string"/>
! * <xs:element name="city" type="xs:string"/>
! * <xs:element name="state" type="xs:string"/>
! * <xs:element name="zip" type="xs:decimal"/>
! * </xs:sequence>
! * </xs:complexType>
*</pre>
* <p> <b> Example 3: </b> Map a class to a global element with an
* anonymous type.
* </p>
* <pre>
* @XmlRootElement
* @XmlType(name="")
* public class USAddress { ...}
*
! * <!-- XML Schema mapping for USAddress -->
! * <xs:element name="USAddress">
! * <xs:complexType>
! * <xs:sequence>
! * <xs:element name="name" type="xs:string"/>
! * <xs:element name="street" type="xs:string"/>
! * <xs:element name="city" type="xs:string"/>
! * <xs:element name="state" type="xs:string"/>
! * <xs:element name="zip" type="xs:decimal"/>
! * </xs:sequence>
! * </xs:complexType>
! * </xs:element>
* </pre>
*
* <p> <b> Example 4: </b> Map a property to a local element with
! * anonymous type.
* <pre>
* //Example: Code fragment
* public class Invoice {
* USAddress addr;
* ...
*** 273,296 ****
*
* @XmlType(name="")
* public class USAddress { ... }
* }
*
! * <!-- XML Schema mapping for USAddress -->
! * <xs:complexType name="Invoice">
! * <xs:sequence>
! * <xs:element name="addr">
! * <xs:complexType>
! * <xs:element name="name", type="xs:string"/>
! * <xs:element name="city", type="xs:string"/>
! * <xs:element name="city" type="xs:string"/>
! * <xs:element name="state" type="xs:string"/>
! * <xs:element name="zip" type="xs:decimal"/>
! * </xs:complexType>
* ...
! * </xs:sequence>
! * </xs:complexType>
* </pre>
*
* <p> <b> Example 5: </b> Map a property to an attribute with
* anonymous type.
*
--- 270,293 ----
*
* @XmlType(name="")
* public class USAddress { ... }
* }
*
! * <!-- XML Schema mapping for USAddress -->
! * <xs:complexType name="Invoice">
! * <xs:sequence>
! * <xs:element name="addr">
! * <xs:complexType>
! * <xs:element name="name", type="xs:string"/>
! * <xs:element name="city", type="xs:string"/>
! * <xs:element name="city" type="xs:string"/>
! * <xs:element name="state" type="xs:string"/>
! * <xs:element name="zip" type="xs:decimal"/>
! * </xs:complexType>
* ...
! * </xs:sequence>
! * </xs:complexType>
* </pre>
*
* <p> <b> Example 5: </b> Map a property to an attribute with
* anonymous type.
*
*** 308,328 ****
* public class USPrice {
* @XmlValue
* public java.math.BigDecimal price;
* }
*
! * <!-- Example: XML Schema fragment -->
! * <xs:complexType name="Item">
! * <xs:sequence>
! * <xs:element name="name" type="xs:string"/>
! * <xs:attribute name="price">
! * <xs:simpleType>
! * <xs:restriction base="xs:decimal"/>
! * </xs:simpleType>
! * </xs:attribute>
! * </xs:sequence>
! * </xs:complexType>
* </pre>
*
* <p> <b> Example 6: </b> Define a factoryClass and factoryMethod
*
* <pre>
--- 305,325 ----
* public class USPrice {
* @XmlValue
* public java.math.BigDecimal price;
* }
*
! * <!-- Example: XML Schema fragment -->
! * <xs:complexType name="Item">
! * <xs:sequence>
! * <xs:element name="name" type="xs:string"/>
! * <xs:attribute name="price">
! * <xs:simpleType>
! * <xs:restriction base="xs:decimal"/>
! * </xs:simpleType>
! * </xs:attribute>
! * </xs:sequence>
! * </xs:complexType>
* </pre>
*
* <p> <b> Example 6: </b> Define a factoryClass and factoryMethod
*
* <pre>
< prev index next >