| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (version 1.7.0_11) on Wed Sep 18 01:54:20 EDT 2013 --> |
| <title>XmlElement (EclipseLink 2.5.1, build 'v20130918-f2b9fc5' API Reference)</title> |
| <meta name="date" content="2013-09-18"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="XmlElement (EclipseLink 2.5.1, build 'v20130918-f2b9fc5' API Reference)"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar_top"> |
| <!-- --> |
| </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><em>EclipseLink 2.5.1, build 'v20130918-f2b9fc5' API Reference</em></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../javax/xml/bind/annotation/XmlAttribute.html" title="annotation in javax.xml.bind.annotation"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../javax/xml/bind/annotation/XmlElement.DEFAULT.html" title="class in javax.xml.bind.annotation"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?javax/xml/bind/annotation/XmlElement.html" target="_top">Frames</a></li> |
| <li><a href="XmlElement.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Required | </li> |
| <li><a href="#annotation_type_optional_element_summary">Optional</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#annotation_type_element_detail">Element</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">javax.xml.bind.annotation</div> |
| <h2 title="Annotation Type XmlElement" class="title">Annotation Type XmlElement</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>@Retention(value=RUNTIME) |
| @Target(value={FIELD,METHOD,PARAMETER}) |
| public @interface <span class="strong">XmlElement</span></pre> |
| <div class="block">Maps a JavaBean property to a XML element derived from property name. |
| |
| <p> <b>Usage</b> </p> |
| <p> |
| </tt>@XmlElement</tt> annotation can be used with the following program |
| elements: |
| <ul> |
| <li> a JavaBean property </li> |
| <li> non static, non transient field </li> |
| <li> within <a href="../../../../javax/xml/bind/annotation/XmlElements.html" title="annotation in javax.xml.bind.annotation"><code>XmlElements</code></a> |
| <p> |
| |
| </ul> |
| |
| The usage is subject to the following constraints: |
| <ul> |
| <li> This annotation can be used with following annotations: |
| <a href="../../../../javax/xml/bind/annotation/XmlID.html" title="annotation in javax.xml.bind.annotation"><code>XmlID</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/XmlIDREF.html" title="annotation in javax.xml.bind.annotation"><code>XmlIDREF</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/XmlList.html" title="annotation in javax.xml.bind.annotation"><code>XmlList</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/XmlSchemaType.html" title="annotation in javax.xml.bind.annotation"><code>XmlSchemaType</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/XmlValue.html" title="annotation in javax.xml.bind.annotation"><code>XmlValue</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/XmlAttachmentRef.html" title="annotation in javax.xml.bind.annotation"><code>XmlAttachmentRef</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/XmlMimeType.html" title="annotation in javax.xml.bind.annotation"><code>XmlMimeType</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/XmlInlineBinaryData.html" title="annotation in javax.xml.bind.annotation"><code>XmlInlineBinaryData</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/XmlElementWrapper.html" title="annotation in javax.xml.bind.annotation"><code>XmlElementWrapper</code></a>, |
| <a href="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html" title="annotation in javax.xml.bind.annotation.adapters"><code>XmlJavaTypeAdapter</code></a></li> |
| <li> if the type of JavaBean property is a collection type of |
| array, an indexed property, or a parameterized list, and |
| this annotation is used with <a href="../../../../javax/xml/bind/annotation/XmlElements.html" title="annotation in javax.xml.bind.annotation"><code>XmlElements</code></a> then, |
| <tt>@XmlElement.type()</tt> must be DEFAULT.class since the |
| collection item type is already known. </li> |
| </ul> |
| |
| <p> |
| A JavaBean property, when annotated with @XmlElement annotation |
| is mapped to a local element in the XML Schema complex type to |
| which the containing class is mapped. |
| |
| <p> |
| <b>Example 1: </b> Map a public non static non final field to local |
| element |
| <pre> |
| //Example: Code fragment |
| public class USPrice { |
| @XmlElement(name="itemprice") |
| public java.math.BigDecimal price; |
| } |
| |
| <!-- Example: Local XML Schema element --> |
| <xs:complexType name="USPrice"/> |
| <xs:sequence> |
| <xs:element name="itemprice" type="xs:decimal" minOccurs="0"/> |
| </sequence> |
| </xs:complexType> |
| </pre> |
| <p> |
| |
| <b> Example 2: </b> Map a field to a nillable element. |
| <pre> |
| |
| //Example: Code fragment |
| public class USPrice { |
| @XmlElement(nillable=true) |
| public java.math.BigDecimal price; |
| } |
| |
| <!-- Example: Local XML Schema element --> |
| <xs:complexType name="USPrice"> |
| <xs:sequence> |
| <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="0"/> |
| </sequence> |
| </xs:complexType> |
| </pre> |
| <p> |
| <b> Example 3: </b> Map a field to a nillable, required element. |
| <pre> |
| |
| //Example: Code fragment |
| public class USPrice { |
| @XmlElement(nillable=true, required=true) |
| public java.math.BigDecimal price; |
| } |
| |
| <!-- Example: Local XML Schema element --> |
| <xs:complexType name="USPrice"> |
| <xs:sequence> |
| <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="1"/> |
| </sequence> |
| </xs:complexType> |
| </pre> |
| <p> |
| |
| <p> <b>Example 4: </b>Map a JavaBean property to an XML element |
| with anonymous type.</p> |
| <p> |
| See Example 6 in @<a href="../../../../javax/xml/bind/annotation/XmlType.html" title="annotation in javax.xml.bind.annotation"><code>XmlType</code></a>. |
| |
| <p></div> |
| <dl><dt><span class="strong">Author:</span></dt> |
| <dd>Sekhar Vajjhala, Sun Microsystems, Inc.</dd> |
| <dt><span class="strong">Since:</span></dt> |
| <dd>JAXB2.0</dd></dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="annotation_type_optional_element_summary"> |
| <!-- --> |
| </a> |
| <h3>Optional Element Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation"> |
| <caption><span>Optional Elements</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Optional Element and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><strong><a href="../../../../javax/xml/bind/annotation/XmlElement.html#defaultValue()">defaultValue</a></strong></code> |
| <div class="block">Default value of this element.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><strong><a href="../../../../javax/xml/bind/annotation/XmlElement.html#name()">name</a></strong></code> |
| <div class="block">Name of the XML Schema element.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><strong><a href="../../../../javax/xml/bind/annotation/XmlElement.html#namespace()">namespace</a></strong></code> |
| <div class="block">XML target namespace of the XML Schema element.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><strong><a href="../../../../javax/xml/bind/annotation/XmlElement.html#nillable()">nillable</a></strong></code> |
| <div class="block">Customize the element declaration to be nillable.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><strong><a href="../../../../javax/xml/bind/annotation/XmlElement.html#required()">required</a></strong></code> |
| <div class="block">Customize the element declaration to be required.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>java.lang.Class</code></td> |
| <td class="colLast"><code><strong><a href="../../../../javax/xml/bind/annotation/XmlElement.html#type()">type</a></strong></code> |
| <div class="block">The Java class being referenced.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="annotation_type_element_detail"> |
| <!-- --> |
| </a> |
| <h3>Element Detail</h3> |
| <a name="name()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>name</h4> |
| <pre>public abstract java.lang.String name</pre> |
| <div class="block">Name of the XML Schema element. |
| <p> If the value is "##default", then element name is derived from the |
| JavaBean property name.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>"##default"</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="nillable()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>nillable</h4> |
| <pre>public abstract boolean nillable</pre> |
| <div class="block">Customize the element declaration to be nillable. |
| <p>If nillable() is true, then the JavaBean property is |
| mapped to a XML Schema nillable element declaration.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>false</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="required()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>required</h4> |
| <pre>public abstract boolean required</pre> |
| <div class="block">Customize the element declaration to be required. |
| <p>If required() is true, then Javabean property is mapped to |
| an XML schema element declaration with minOccurs="1". |
| maxOccurs is "1" for a single valued property and "unbounded" |
| for a multivalued property. |
| <p>If required() is false, then the Javabean property is mapped |
| to XML Schema element declaration with minOccurs="0". |
| maxOccurs is "1" for a single valued property and "unbounded" |
| for a multivalued property.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>false</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="namespace()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>namespace</h4> |
| <pre>public abstract java.lang.String namespace</pre> |
| <div class="block">XML target namespace of the XML Schema element. |
| <p> |
| If the value is "##default", then the namespace is determined |
| as follows: |
| <ol> |
| <li> |
| If the enclosing package has <a href="../../../../javax/xml/bind/annotation/XmlSchema.html" title="annotation in javax.xml.bind.annotation"><code>XmlSchema</code></a> annotation, |
| and its <a href="../../../../javax/xml/bind/annotation/XmlSchema.html#elementFormDefault()"><code>elementFormDefault</code></a> |
| is <a href="../../../../javax/xml/bind/annotation/XmlNsForm.html#QUALIFIED"><code>QUALIFIED</code></a>, then the namespace of |
| the enclosing class. |
| |
| <li> |
| Otherwise "" (which produces unqualified element in the default |
| namespace. |
| </ol></div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>"##default"</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="defaultValue()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>defaultValue</h4> |
| <pre>public abstract java.lang.String defaultValue</pre> |
| <div class="block">Default value of this element. |
| |
| <p> |
| The '' value specified as a default of this annotation element |
| is used as a poor-man's substitute for null to allow implementations |
| to recognize the 'no default value' state.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>"\u0000"</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="type()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>type</h4> |
| <pre>public abstract java.lang.Class type</pre> |
| <div class="block">The Java class being referenced.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>javax.xml.bind.annotation.XmlElement.DEFAULT.class</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar_bottom"> |
| <!-- --> |
| </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><em>EclipseLink 2.5.1, build 'v20130918-f2b9fc5' API Reference</em></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../javax/xml/bind/annotation/XmlAttribute.html" title="annotation in javax.xml.bind.annotation"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../javax/xml/bind/annotation/XmlElement.DEFAULT.html" title="class in javax.xml.bind.annotation"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?javax/xml/bind/annotation/XmlElement.html" target="_top">Frames</a></li> |
| <li><a href="XmlElement.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Required | </li> |
| <li><a href="#annotation_type_optional_element_summary">Optional</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#annotation_type_element_detail">Element</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |