Thu, 31 Aug 2017 15:18:52 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package javax.xml.bind.annotation; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import static java.lang.annotation.ElementType.TYPE; |
aoqi@0 | 29 | import java.lang.annotation.Retention; |
aoqi@0 | 30 | import static java.lang.annotation.RetentionPolicy.RUNTIME; |
aoqi@0 | 31 | import java.lang.annotation.Target; |
aoqi@0 | 32 | |
aoqi@0 | 33 | /** |
aoqi@0 | 34 | * <p> |
aoqi@0 | 35 | * Maps a class or an enum type to a XML Schema type. |
aoqi@0 | 36 | * |
aoqi@0 | 37 | * <p><b>Usage</b></p> |
aoqi@0 | 38 | * <p> The <tt>@XmlType</tt> annnotation can be used with the following program |
aoqi@0 | 39 | * elements: |
aoqi@0 | 40 | * <ul> |
aoqi@0 | 41 | * <li> a top level class </li> |
aoqi@0 | 42 | * <li> an enum type </li> |
aoqi@0 | 43 | * </ul> |
aoqi@0 | 44 | * |
aoqi@0 | 45 | * <p>See "Package Specification" in javax.xml.bind.package javadoc for |
aoqi@0 | 46 | * additional common information.</p> |
aoqi@0 | 47 | * |
aoqi@0 | 48 | * <h3> Mapping a Class </h3> |
aoqi@0 | 49 | * <p> |
aoqi@0 | 50 | * A class maps to a XML Schema type. A class is a data container for |
aoqi@0 | 51 | * values represented by properties and fields. A schema type is a |
aoqi@0 | 52 | * data container for values represented by schema components within a |
aoqi@0 | 53 | * schema type's content model (e.g. model groups, attributes etc). |
aoqi@0 | 54 | * <p> To be mapped, a class must either have a public no-arg |
aoqi@0 | 55 | * constructor or a static no-arg factory method. The static factory |
aoqi@0 | 56 | * method can be specified in <tt>factoryMethod()</tt> and |
aoqi@0 | 57 | * <tt>factoryClass()</tt> annotation elements. The static factory |
aoqi@0 | 58 | * method or the no-arg constructor is used during unmarshalling to |
aoqi@0 | 59 | * create an instance of this class. If both are present, the static |
aoqi@0 | 60 | * factory method overrides the no-arg constructor. |
aoqi@0 | 61 | * <p> |
aoqi@0 | 62 | * A class maps to either a XML Schema complex type or a XML Schema simple |
aoqi@0 | 63 | * type. The XML Schema type is derived based on the |
aoqi@0 | 64 | * mapping of JavaBean properties and fields contained within the |
aoqi@0 | 65 | * class. The schema type to which the class is mapped can either be |
aoqi@0 | 66 | * named or anonymous. A class can be mapped to an anonymous schema |
aoqi@0 | 67 | * type by annotating the class with <tt>@XmlType(name="")</tt>. |
aoqi@0 | 68 | * <p> |
aoqi@0 | 69 | * Either a global element, local element or a local attribute can be |
aoqi@0 | 70 | * associated with an anonymous type as follows: |
aoqi@0 | 71 | * <ul> |
aoqi@0 | 72 | * <li><b>global element: </b> A global element of an anonymous |
aoqi@0 | 73 | * type can be derived by annotating the class with @{@link |
aoqi@0 | 74 | * XmlRootElement}. See Example 3 below. </li> |
aoqi@0 | 75 | * |
aoqi@0 | 76 | * <li><b>local element: </b> A JavaBean property that references |
aoqi@0 | 77 | * a class annotated with @XmlType(name="") and is mapped to the |
aoqi@0 | 78 | * element associated with the anonymous type. See Example 4 |
aoqi@0 | 79 | * below.</li> |
aoqi@0 | 80 | * |
aoqi@0 | 81 | * <li><b>attribute: </b> A JavaBean property that references |
aoqi@0 | 82 | * a class annotated with @XmlType(name="") and is mapped to the |
aoqi@0 | 83 | * attribute associated with the anonymous type. See Example 5 below. </li> |
aoqi@0 | 84 | * </ul> |
aoqi@0 | 85 | * <b> Mapping to XML Schema Complex Type </b> |
aoqi@0 | 86 | * <ul> |
aoqi@0 | 87 | * <li>If class is annotated with <tt>@XmlType(name="") </tt>, it |
aoqi@0 | 88 | * is mapped to an anonymous type otherwise, the class name maps |
aoqi@0 | 89 | * to a complex type name. The <tt>XmlName()</tt> annotation element |
aoqi@0 | 90 | * can be used to customize the name.</li> |
aoqi@0 | 91 | * |
aoqi@0 | 92 | * <li> Properties and fields that are mapped to elements are mapped to a |
aoqi@0 | 93 | * content model within a complex type. The annotation element |
aoqi@0 | 94 | * <tt>propOrder()</tt> can be used to customize the content model to be |
aoqi@0 | 95 | * <tt>xs:all</tt> or <tt>xs:sequence</tt>. It is used for specifying |
aoqi@0 | 96 | * the order of XML elements in <tt>xs:sequence</tt>. </li> |
aoqi@0 | 97 | * |
aoqi@0 | 98 | * <li> Properties and fields can be mapped to attributes within the |
aoqi@0 | 99 | * complex type. </li> |
aoqi@0 | 100 | * |
aoqi@0 | 101 | * <li> The targetnamespace of the XML Schema type can be customized |
aoqi@0 | 102 | * using the annotation element <tt>namespace()</tt>. </li> |
aoqi@0 | 103 | * </ul> |
aoqi@0 | 104 | * |
aoqi@0 | 105 | * <p> |
aoqi@0 | 106 | * <b> Mapping class to XML Schema simple type </b> |
aoqi@0 | 107 | * <p> |
aoqi@0 | 108 | * A class can be mapped to a XML Schema simple type using the |
aoqi@0 | 109 | * <tt>@XmlValue</tt> annotation. For additional details and examples, |
aoqi@0 | 110 | * see @{@link XmlValue} annotation type. |
aoqi@0 | 111 | * <p> |
aoqi@0 | 112 | * The following table shows the mapping of the class to a XML Schema |
aoqi@0 | 113 | * complex type or simple type. The notational symbols used in the table are: |
aoqi@0 | 114 | * <ul> |
aoqi@0 | 115 | * <li> -> : represents a mapping </li> |
aoqi@0 | 116 | * <li> [x]+ : one or more occurances of x </li> |
aoqi@0 | 117 | * <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with |
aoqi@0 | 118 | * <tt>@XmlValue</tt></li> |
aoqi@0 | 119 | * <li> X : don't care |
aoqi@0 | 120 | * </ul> |
aoqi@0 | 121 | * <blockquote> |
aoqi@0 | 122 | * <table border="1" cellpadding="4" cellspacing="3"> |
aoqi@0 | 123 | * <tbody> |
aoqi@0 | 124 | * <tr> |
aoqi@0 | 125 | * <td><b>Target</b></td> |
aoqi@0 | 126 | * <td><b>propOrder</b></td> |
aoqi@0 | 127 | * <td><b>ClassBody</b></td> |
aoqi@0 | 128 | * <td><b>ComplexType</b></td> |
aoqi@0 | 129 | * <td><b>SimpleType</b></td> |
aoqi@0 | 130 | * </tr> |
aoqi@0 | 131 | * |
aoqi@0 | 132 | * <tr valign="top"> |
aoqi@0 | 133 | * <td>Class</td> |
aoqi@0 | 134 | * <td>{}</td> |
aoqi@0 | 135 | * <td>[property]+ -> elements</td> |
aoqi@0 | 136 | * <td>complexcontent<br>xs:all</td> |
aoqi@0 | 137 | * <td> </td> |
aoqi@0 | 138 | * </tr> |
aoqi@0 | 139 | * |
aoqi@0 | 140 | * <tr valign="top"> |
aoqi@0 | 141 | * <td>Class</td> |
aoqi@0 | 142 | * <td>non empty</td> |
aoqi@0 | 143 | * <td>[property]+ -> elements</td> |
aoqi@0 | 144 | * <td>complexcontent<br>xs:sequence</td> |
aoqi@0 | 145 | * <td> </td> |
aoqi@0 | 146 | * </tr> |
aoqi@0 | 147 | * |
aoqi@0 | 148 | * <tr valign="top"> |
aoqi@0 | 149 | * <td>Class</td> |
aoqi@0 | 150 | * <td>X</td> |
aoqi@0 | 151 | * <td>no property -> element</td> |
aoqi@0 | 152 | * <td>complexcontent<br>empty sequence</td> |
aoqi@0 | 153 | * <td> </td> |
aoqi@0 | 154 | * </tr> |
aoqi@0 | 155 | * |
aoqi@0 | 156 | * <tr valign="top"> |
aoqi@0 | 157 | * <td>Class</td> |
aoqi@0 | 158 | * <td>X</td> |
aoqi@0 | 159 | * <td>1 [ <tt>@XmlValue</tt> property] && <br> [property]+ |
aoqi@0 | 160 | * ->attributes</td> |
aoqi@0 | 161 | * <td>simplecontent</td> |
aoqi@0 | 162 | * <td> </td> |
aoqi@0 | 163 | * </tr> |
aoqi@0 | 164 | * |
aoqi@0 | 165 | * <tr valign="top"> |
aoqi@0 | 166 | * <td>Class</td> |
aoqi@0 | 167 | * <td>X</td> |
aoqi@0 | 168 | * <td>1 [ <tt>@XmlValue</tt> property ]&& <br> no properties |
aoqi@0 | 169 | * -> attribute</td> |
aoqi@0 | 170 | * <td> </td> |
aoqi@0 | 171 | * <td>simpletype</td> |
aoqi@0 | 172 | * <td> </td> |
aoqi@0 | 173 | * </tr> |
aoqi@0 | 174 | * </tbody> |
aoqi@0 | 175 | * </table> |
aoqi@0 | 176 | * </blockquote> |
aoqi@0 | 177 | * |
aoqi@0 | 178 | * <h3> Mapping an enum type </h3> |
aoqi@0 | 179 | * |
aoqi@0 | 180 | * An enum type maps to a XML schema simple type with enumeration |
aoqi@0 | 181 | * facets. The following annotation elements are ignored since they |
aoqi@0 | 182 | * are not meaningful: <tt>propOrder()</tt> , <tt>factoryMethod()</tt> , |
aoqi@0 | 183 | * <tt>factoryClass()</tt> . |
aoqi@0 | 184 | * |
aoqi@0 | 185 | * <h3> Usage with other annotations </h3> |
aoqi@0 | 186 | * <p> This annotation can be used with the following annotations: |
aoqi@0 | 187 | * {@link XmlRootElement}, {@link XmlAccessorOrder}, {@link XmlAccessorType}, |
aoqi@0 | 188 | * {@link XmlEnum}. However, {@link |
aoqi@0 | 189 | * XmlAccessorOrder} and {@link XmlAccessorType} are ignored when this |
aoqi@0 | 190 | * annotation is used on an enum type. |
aoqi@0 | 191 | * |
aoqi@0 | 192 | * <p> <b> Example 1: </b> Map a class to a complex type with |
aoqi@0 | 193 | * xs:sequence with a customized ordering of JavaBean properties. |
aoqi@0 | 194 | * </p> |
aoqi@0 | 195 | * |
aoqi@0 | 196 | * <pre> |
aoqi@0 | 197 | * @XmlType(propOrder={"street", "city" , "state", "zip", "name" }) |
aoqi@0 | 198 | * public class USAddress { |
aoqi@0 | 199 | * String getName() {..}; |
aoqi@0 | 200 | * void setName(String) {..}; |
aoqi@0 | 201 | * |
aoqi@0 | 202 | * String getStreet() {..}; |
aoqi@0 | 203 | * void setStreet(String) {..}; |
aoqi@0 | 204 | * |
aoqi@0 | 205 | * String getCity() {..}; |
aoqi@0 | 206 | * void setCity(String) {..}; |
aoqi@0 | 207 | * |
aoqi@0 | 208 | * String getState() {..}; |
aoqi@0 | 209 | * void setState(String) {..}; |
aoqi@0 | 210 | * |
aoqi@0 | 211 | * java.math.BigDecimal getZip() {..}; |
aoqi@0 | 212 | * void setZip(java.math.BigDecimal) {..}; |
aoqi@0 | 213 | * } |
aoqi@0 | 214 | * |
aoqi@0 | 215 | * <!-- XML Schema mapping for USAddress --> |
aoqi@0 | 216 | * <xs:complexType name="USAddress"> |
aoqi@0 | 217 | * <xs:sequence> |
aoqi@0 | 218 | * <xs:element name="street" type="xs:string"/> |
aoqi@0 | 219 | * <xs:element name="city" type="xs:string"/> |
aoqi@0 | 220 | * <xs:element name="state" type="xs:string"/> |
aoqi@0 | 221 | * <xs:element name="zip" type="xs:decimal"/> |
aoqi@0 | 222 | * <xs:element name="name" type="xs:string"/> |
aoqi@0 | 223 | * </xs:all> |
aoqi@0 | 224 | * </xs:complexType> |
aoqi@0 | 225 | * </pre> |
aoqi@0 | 226 | * <p> <b> Example 2: </b> Map a class to a complex type with |
aoqi@0 | 227 | * xs:all </p> |
aoqi@0 | 228 | * <pre> |
aoqi@0 | 229 | * @XmlType(propOrder={}) |
aoqi@0 | 230 | * public class USAddress { ...} |
aoqi@0 | 231 | * |
aoqi@0 | 232 | * <!-- XML Schema mapping for USAddress --> |
aoqi@0 | 233 | * <xs:complexType name="USAddress"> |
aoqi@0 | 234 | * <xs:all> |
aoqi@0 | 235 | * <xs:element name="name" type="xs:string"/> |
aoqi@0 | 236 | * <xs:element name="street" type="xs:string"/> |
aoqi@0 | 237 | * <xs:element name="city" type="xs:string"/> |
aoqi@0 | 238 | * <xs:element name="state" type="xs:string"/> |
aoqi@0 | 239 | * <xs:element name="zip" type="xs:decimal"/> |
aoqi@0 | 240 | * </xs:sequence> |
aoqi@0 | 241 | * </xs:complexType> |
aoqi@0 | 242 | *</pre> |
aoqi@0 | 243 | * <p> <b> Example 3: </b> Map a class to a global element with an |
aoqi@0 | 244 | * anonymous type. |
aoqi@0 | 245 | * </p> |
aoqi@0 | 246 | * <pre> |
aoqi@0 | 247 | * @XmlRootElement |
aoqi@0 | 248 | * @XmlType(name="") |
aoqi@0 | 249 | * public class USAddress { ...} |
aoqi@0 | 250 | * |
aoqi@0 | 251 | * <!-- XML Schema mapping for USAddress --> |
aoqi@0 | 252 | * <xs:element name="USAddress"> |
aoqi@0 | 253 | * <xs:complexType> |
aoqi@0 | 254 | * <xs:sequence> |
aoqi@0 | 255 | * <xs:element name="name" type="xs:string"/> |
aoqi@0 | 256 | * <xs:element name="street" type="xs:string"/> |
aoqi@0 | 257 | * <xs:element name="city" type="xs:string"/> |
aoqi@0 | 258 | * <xs:element name="state" type="xs:string"/> |
aoqi@0 | 259 | * <xs:element name="zip" type="xs:decimal"/> |
aoqi@0 | 260 | * </xs:sequence> |
aoqi@0 | 261 | * </xs:complexType> |
aoqi@0 | 262 | * </xs:element> |
aoqi@0 | 263 | * </pre> |
aoqi@0 | 264 | * |
aoqi@0 | 265 | * <p> <b> Example 4: </b> Map a property to a local element with |
aoqi@0 | 266 | * anonmyous type. |
aoqi@0 | 267 | * <pre> |
aoqi@0 | 268 | * //Example: Code fragment |
aoqi@0 | 269 | * public class Invoice { |
aoqi@0 | 270 | * USAddress addr; |
aoqi@0 | 271 | * ... |
aoqi@0 | 272 | * } |
aoqi@0 | 273 | * |
aoqi@0 | 274 | * @XmlType(name="") |
aoqi@0 | 275 | * public class USAddress { ... } |
aoqi@0 | 276 | * } |
aoqi@0 | 277 | * |
aoqi@0 | 278 | * <!-- XML Schema mapping for USAddress --> |
aoqi@0 | 279 | * <xs:complexType name="Invoice"> |
aoqi@0 | 280 | * <xs:sequence> |
aoqi@0 | 281 | * <xs:element name="addr"> |
aoqi@0 | 282 | * <xs:complexType> |
aoqi@0 | 283 | * <xs:element name="name", type="xs:string"/> |
aoqi@0 | 284 | * <xs:element name="city", type="xs:string"/> |
aoqi@0 | 285 | * <xs:element name="city" type="xs:string"/> |
aoqi@0 | 286 | * <xs:element name="state" type="xs:string"/> |
aoqi@0 | 287 | * <xs:element name="zip" type="xs:decimal"/> |
aoqi@0 | 288 | * </xs:complexType> |
aoqi@0 | 289 | * ... |
aoqi@0 | 290 | * </xs:sequence> |
aoqi@0 | 291 | * </xs:complexType> |
aoqi@0 | 292 | * </pre> |
aoqi@0 | 293 | * |
aoqi@0 | 294 | * <p> <b> Example 5: </b> Map a property to an attribute with |
aoqi@0 | 295 | * anonymous type. |
aoqi@0 | 296 | * |
aoqi@0 | 297 | * <pre> |
aoqi@0 | 298 | * |
aoqi@0 | 299 | * //Example: Code fragment |
aoqi@0 | 300 | * public class Item { |
aoqi@0 | 301 | * public String name; |
aoqi@0 | 302 | * @XmlAttribute |
aoqi@0 | 303 | * public USPrice price; |
aoqi@0 | 304 | * } |
aoqi@0 | 305 | * |
aoqi@0 | 306 | * // map class to anonymous simple type. |
aoqi@0 | 307 | * @XmlType(name="") |
aoqi@0 | 308 | * public class USPrice { |
aoqi@0 | 309 | * @XmlValue |
aoqi@0 | 310 | * public java.math.BigDecimal price; |
aoqi@0 | 311 | * } |
aoqi@0 | 312 | * |
aoqi@0 | 313 | * <!-- Example: XML Schema fragment --> |
aoqi@0 | 314 | * <xs:complexType name="Item"> |
aoqi@0 | 315 | * <xs:sequence> |
aoqi@0 | 316 | * <xs:element name="name" type="xs:string"/> |
aoqi@0 | 317 | * <xs:attribute name="price"> |
aoqi@0 | 318 | * <xs:simpleType> |
aoqi@0 | 319 | * <xs:restriction base="xs:decimal"/> |
aoqi@0 | 320 | * </xs:simpleType> |
aoqi@0 | 321 | * </xs:attribute> |
aoqi@0 | 322 | * </xs:sequence> |
aoqi@0 | 323 | * </xs:complexType> |
aoqi@0 | 324 | * </pre> |
aoqi@0 | 325 | * |
aoqi@0 | 326 | * <p> <b> Example 6: </b> Define a factoryClass and factoryMethod |
aoqi@0 | 327 | * |
aoqi@0 | 328 | * <pre> |
aoqi@0 | 329 | * @XmlType(name="USAddressType", factoryClass=USAddressFactory.class, |
aoqi@0 | 330 | * factoryMethod="getUSAddress") |
aoqi@0 | 331 | * public class USAddress { |
aoqi@0 | 332 | * |
aoqi@0 | 333 | * private String city; |
aoqi@0 | 334 | * private String name; |
aoqi@0 | 335 | * private String state; |
aoqi@0 | 336 | * private String street; |
aoqi@0 | 337 | * private int zip; |
aoqi@0 | 338 | * |
aoqi@0 | 339 | * public USAddress(String name, String street, String city, |
aoqi@0 | 340 | * String state, int zip) { |
aoqi@0 | 341 | * this.name = name; |
aoqi@0 | 342 | * this.street = street; |
aoqi@0 | 343 | * this.city = city; |
aoqi@0 | 344 | * this.state = state; |
aoqi@0 | 345 | * this.zip = zip; |
aoqi@0 | 346 | * } |
aoqi@0 | 347 | * } |
aoqi@0 | 348 | * |
aoqi@0 | 349 | * public class USAddressFactory { |
aoqi@0 | 350 | * public static USAddress getUSAddress(){ |
aoqi@0 | 351 | * return new USAddress("Mark Baker", "23 Elm St", |
aoqi@0 | 352 | * "Dayton", "OH", 90952); |
aoqi@0 | 353 | * } |
aoqi@0 | 354 | * |
aoqi@0 | 355 | * </pre> |
aoqi@0 | 356 | * |
aoqi@0 | 357 | * <p> <b> Example 7: </b> Define factoryMethod and use the default factoryClass |
aoqi@0 | 358 | * |
aoqi@0 | 359 | * <pre> |
aoqi@0 | 360 | * @XmlType(name="USAddressType", factoryMethod="getNewInstance") |
aoqi@0 | 361 | * public class USAddress { |
aoqi@0 | 362 | * |
aoqi@0 | 363 | * private String city; |
aoqi@0 | 364 | * private String name; |
aoqi@0 | 365 | * private String state; |
aoqi@0 | 366 | * private String street; |
aoqi@0 | 367 | * private int zip; |
aoqi@0 | 368 | * |
aoqi@0 | 369 | * private USAddress() {} |
aoqi@0 | 370 | * |
aoqi@0 | 371 | * public static USAddress getNewInstance(){ |
aoqi@0 | 372 | * return new USAddress(); |
aoqi@0 | 373 | * } |
aoqi@0 | 374 | * } |
aoqi@0 | 375 | * </pre> |
aoqi@0 | 376 | * |
aoqi@0 | 377 | * @author Sekhar Vajjhala, Sun Microsystems, Inc. |
aoqi@0 | 378 | * @see XmlElement |
aoqi@0 | 379 | * @see XmlAttribute |
aoqi@0 | 380 | * @see XmlValue |
aoqi@0 | 381 | * @see XmlSchema |
aoqi@0 | 382 | * @since JAXB2.0 |
aoqi@0 | 383 | */ |
aoqi@0 | 384 | |
aoqi@0 | 385 | @Retention(RUNTIME) @Target({TYPE}) |
aoqi@0 | 386 | public @interface XmlType { |
aoqi@0 | 387 | /** |
aoqi@0 | 388 | * Name of the XML Schema type which the class is mapped. |
aoqi@0 | 389 | */ |
aoqi@0 | 390 | String name() default "##default" ; |
aoqi@0 | 391 | |
aoqi@0 | 392 | /** |
aoqi@0 | 393 | * Specifies the order for XML Schema elements when class is |
aoqi@0 | 394 | * mapped to a XML Schema complex type. |
aoqi@0 | 395 | * |
aoqi@0 | 396 | * <p> Refer to the table for how the propOrder affects the |
aoqi@0 | 397 | * mapping of class </p> |
aoqi@0 | 398 | * |
aoqi@0 | 399 | * <p> The propOrder is a list of names of JavaBean properties in |
aoqi@0 | 400 | * the class. Each name in the list is the name of a Java |
aoqi@0 | 401 | * identifier of the JavaBean property. The order in which |
aoqi@0 | 402 | * JavaBean properties are listed is the order of XML Schema |
aoqi@0 | 403 | * elements to which the JavaBean properties are mapped. </p> |
aoqi@0 | 404 | * <p> All of the JavaBean properties being mapped to XML Schema elements |
aoqi@0 | 405 | * must be listed. |
aoqi@0 | 406 | * <p> A JavaBean property or field listed in propOrder must not |
aoqi@0 | 407 | * be transient or annotated with <tt>@XmlTransient</tt>. |
aoqi@0 | 408 | * <p> The default ordering of JavaBean properties is determined |
aoqi@0 | 409 | * by @{@link XmlAccessorOrder}. |
aoqi@0 | 410 | */ |
aoqi@0 | 411 | String[] propOrder() default {""}; |
aoqi@0 | 412 | |
aoqi@0 | 413 | /** |
aoqi@0 | 414 | * Name of the target namespace of the XML Schema type. By |
aoqi@0 | 415 | * default, this is the target namespace to which the package |
aoqi@0 | 416 | * containing the class is mapped. |
aoqi@0 | 417 | */ |
aoqi@0 | 418 | String namespace() default "##default" ; |
aoqi@0 | 419 | |
aoqi@0 | 420 | /** |
aoqi@0 | 421 | * Class containing a no-arg factory method for creating an |
aoqi@0 | 422 | * instance of this class. The default is this class. |
aoqi@0 | 423 | * |
aoqi@0 | 424 | * <p>If <tt>factoryClass</tt> is DEFAULT.class and |
aoqi@0 | 425 | * <tt>factoryMethod</tt> is "", then there is no static factory |
aoqi@0 | 426 | * method. |
aoqi@0 | 427 | * |
aoqi@0 | 428 | * <p>If <tt>factoryClass</tt> is DEFAULT.class and |
aoqi@0 | 429 | * <tt>factoryMethod</tt> is not "", then |
aoqi@0 | 430 | * <tt>factoryMethod</tt> is the name of a static factory method |
aoqi@0 | 431 | * in this class. |
aoqi@0 | 432 | * |
aoqi@0 | 433 | * <p>If <tt>factoryClass</tt> is not DEFAULT.class, then |
aoqi@0 | 434 | * <tt>factoryMethod</tt> must not be "" and must be the name of |
aoqi@0 | 435 | * a static factory method specified in <tt>factoryClass</tt>. |
aoqi@0 | 436 | */ |
aoqi@0 | 437 | Class factoryClass() default DEFAULT.class; |
aoqi@0 | 438 | |
aoqi@0 | 439 | /** |
aoqi@0 | 440 | * Used in {@link XmlType#factoryClass()} to |
aoqi@0 | 441 | * signal that either factory mehod is not used or |
aoqi@0 | 442 | * that it's in the class with this {@link XmlType} itself. |
aoqi@0 | 443 | */ |
aoqi@0 | 444 | static final class DEFAULT {} |
aoqi@0 | 445 | |
aoqi@0 | 446 | /** |
aoqi@0 | 447 | * Name of a no-arg factory method in the class specified in |
aoqi@0 | 448 | * <tt>factoryClass</tt> factoryClass(). |
aoqi@0 | 449 | * |
aoqi@0 | 450 | */ |
aoqi@0 | 451 | String factoryMethod() default ""; |
aoqi@0 | 452 | } |