| <!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>XmlEnumValue (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="XmlEnumValue (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/XmlEnum.html" title="annotation in javax.xml.bind.annotation"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../javax/xml/bind/annotation/XmlID.html" title="annotation 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/XmlEnumValue.html" target="_top">Frames</a></li> |
| <li><a href="XmlEnumValue.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><a href="#annotation_type_required_element_summary">Required</a> | </li> |
| <li>Optional</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 XmlEnumValue" class="title">Annotation Type XmlEnumValue</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>@Retention(value=RUNTIME) |
| @Target(value=FIELD) |
| public @interface <span class="strong">XmlEnumValue</span></pre> |
| <div class="block">Maps an enum constant in <code>Enum</code> type to XML representation. |
| |
| <p> <b>Usage</b> </p> |
| |
| <p> The <tt>@XmlEnumValue</tt> annotation can be used with the |
| following program elements: |
| <ul> |
| <li>enum constant</li> |
| </ul> |
| |
| <p>See "Package Specification" in javax.xml.bind.package javadoc for |
| additional common information.</p> |
| |
| <p>This annotation, together with <a href="../../../../javax/xml/bind/annotation/XmlEnum.html" title="annotation in javax.xml.bind.annotation"><code>XmlEnum</code></a> provides a |
| mapping of enum type to XML representation. |
| |
| <p>An enum type is mapped to a schema simple type with enumeration |
| facets. The schema type is derived from the Java type specified in |
| <tt>@XmlEnum.value()</tt>. Each enum constant <tt>@XmlEnumValue</tt> |
| must have a valid lexical representation for the type |
| <tt>@XmlEnum.value()</tt> |
| |
| <p> In the absence of this annotation, <code>Enum.name()</code> is used |
| as the XML representation. |
| |
| <p> <b>Example 1: </b>Map enum constant name -> enumeration facet</p> |
| <pre> |
| //Example: Code fragment |
| @XmlEnum(String.class) |
| public enum Card { CLUBS, DIAMONDS, HEARTS, SPADES } |
| |
| <!-- Example: XML Schema fragment --> |
| <xs:simpleType name="Card"> |
| <xs:restriction base="xs:string"/> |
| <xs:enumeration value="CLUBS"/> |
| <xs:enumeration value="DIAMONDS"/> |
| <xs:enumeration value="HEARTS"/> |
| <xs:enumeration value="SPADES"/> |
| </xs:simpleType> |
| </pre> |
| |
| <p><b>Example 2: </b>Map enum constant name(value) -> enumeration facet </p> |
| <pre> |
| //Example: code fragment |
| @XmlType |
| @XmlEnum(Integer.class) |
| public enum Coin { |
| @XmlEnumValue("1") PENNY(1), |
| @XmlEnumValue("5") NICKEL(5), |
| @XmlEnumValue("10") DIME(10), |
| @XmlEnumValue("25") QUARTER(25) } |
| |
| <!-- Example: XML Schema fragment --> |
| <xs:simpleType name="Coin"> |
| <xs:restriction base="xs:int"> |
| <xs:enumeration value="1"/> |
| <xs:enumeration value="5"/> |
| <xs:enumeration value="10"/> |
| <xs:enumeration value="25"/> |
| </xs:restriction> |
| </xs:simpleType> |
| </pre> |
| |
| <p><b>Example 3: </b>Map enum constant name -> enumeration facet </p> |
| |
| <pre> |
| //Code fragment |
| @XmlType |
| @XmlEnum(Integer.class) |
| public enum Code { |
| @XmlEnumValue("1") ONE, |
| @XmlEnumValue("2") TWO; |
| } |
| |
| <!-- Example: XML Schema fragment --> |
| <xs:simpleType name="Code"> |
| <xs:restriction base="xs:int"> |
| <xs:enumeration value="1"/> |
| <xs:enumeration value="2"/> |
| </xs:restriction> |
| </xs:simpleType> |
| </pre></div> |
| <dl><dt><span class="strong">Since:</span></dt> |
| <dd>JAXB 2.0</dd></dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="annotation_type_required_element_summary"> |
| <!-- --> |
| </a> |
| <h3>Required Element Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Required Element Summary table, listing required elements, and an explanation"> |
| <caption><span>Required Elements</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Required 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/XmlEnumValue.html#value()">value</a></strong></code> </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="value()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>value</h4> |
| <pre>public abstract java.lang.String value</pre> |
| </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/XmlEnum.html" title="annotation in javax.xml.bind.annotation"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../javax/xml/bind/annotation/XmlID.html" title="annotation 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/XmlEnumValue.html" target="_top">Frames</a></li> |
| <li><a href="XmlEnumValue.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><a href="#annotation_type_required_element_summary">Required</a> | </li> |
| <li>Optional</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> |