21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.xml.bind.annotation; 27 28 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 29 import java.lang.annotation.Retention; 30 import java.lang.annotation.Target; 31 32 import static java.lang.annotation.ElementType.*; 33 import static java.lang.annotation.ElementType.PARAMETER; 34 import static java.lang.annotation.RetentionPolicy.*; 35 36 /** 37 * Maps a JavaBean property to a XML element derived from property name. 38 * 39 * <p> <b>Usage</b> 40 * <p> 41 * <tt>@XmlElement</tt> annotation can be used with the following program 42 * elements: 43 * <ul> 44 * <li> a JavaBean property </li> 45 * <li> non static, non transient field </li> 46 * <li> within {@link XmlElements} 47 * </ul> 48 * 49 * The usage is subject to the following constraints: 50 * <ul> 51 * <li> This annotation can be used with following annotations: 52 * {@link XmlID}, 53 * {@link XmlIDREF}, 54 * {@link XmlList}, 55 * {@link XmlSchemaType}, 56 * {@link XmlValue}, 57 * {@link XmlAttachmentRef}, 58 * {@link XmlMimeType}, 59 * {@link XmlInlineBinaryData}, 60 * {@link XmlElementWrapper}, 61 * {@link XmlJavaTypeAdapter}</li> 62 * <li> if the type of JavaBean property is a collection type of 63 * array, an indexed property, or a parameterized list, and 64 * this annotation is used with {@link XmlElements} then, 65 * <tt>@XmlElement.type()</tt> must be DEFAULT.class since the 66 * collection item type is already known. </li> 67 * </ul> 68 * 69 * <p> 70 * A JavaBean property, when annotated with @XmlElement annotation 71 * is mapped to a local element in the XML Schema complex type to 72 * which the containing class is mapped. 73 * 74 * <p> 75 * <b>Example 1: </b> Map a public non static non final field to local 76 * element 77 * <pre> 78 * //Example: Code fragment 79 * public class USPrice { 80 * {@literal @}XmlElement(name="itemprice") 81 * public java.math.BigDecimal price; 82 * } 83 * {@code 84 * 85 * <!-- Example: Local XML Schema element --> | 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.xml.bind.annotation; 27 28 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 29 import java.lang.annotation.Retention; 30 import java.lang.annotation.Target; 31 32 import static java.lang.annotation.ElementType.*; 33 import static java.lang.annotation.ElementType.PARAMETER; 34 import static java.lang.annotation.RetentionPolicy.*; 35 36 /** 37 * Maps a JavaBean property to a XML element derived from property name. 38 * 39 * <p> <b>Usage</b> 40 * <p> 41 * {@code @XmlElement} annotation can be used with the following program 42 * elements: 43 * <ul> 44 * <li> a JavaBean property </li> 45 * <li> non static, non transient field </li> 46 * <li> within {@link XmlElements} 47 * </ul> 48 * 49 * The usage is subject to the following constraints: 50 * <ul> 51 * <li> This annotation can be used with following annotations: 52 * {@link XmlID}, 53 * {@link XmlIDREF}, 54 * {@link XmlList}, 55 * {@link XmlSchemaType}, 56 * {@link XmlValue}, 57 * {@link XmlAttachmentRef}, 58 * {@link XmlMimeType}, 59 * {@link XmlInlineBinaryData}, 60 * {@link XmlElementWrapper}, 61 * {@link XmlJavaTypeAdapter}</li> 62 * <li> if the type of JavaBean property is a collection type of 63 * array, an indexed property, or a parameterized list, and 64 * this annotation is used with {@link XmlElements} then, 65 * {@code @XmlElement.type()} must be DEFAULT.class since the 66 * collection item type is already known. </li> 67 * </ul> 68 * 69 * <p> 70 * A JavaBean property, when annotated with @XmlElement annotation 71 * is mapped to a local element in the XML Schema complex type to 72 * which the containing class is mapped. 73 * 74 * <p> 75 * <b>Example 1: </b> Map a public non static non final field to local 76 * element 77 * <pre> 78 * //Example: Code fragment 79 * public class USPrice { 80 * {@literal @}XmlElement(name="itemprice") 81 * public java.math.BigDecimal price; 82 * } 83 * {@code 84 * 85 * <!-- Example: Local XML Schema element --> |