|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value=FIELD) @Retention(value=RUNTIME) public @interface MOEnumXmlName
Defines the XML name used for an enumeration constant.
When mapping a Java 5 enumeration to XML, the default constant names of the XML enumerations match the Java constant names. This annotation allows to control the XML constant names, replacing the Java names with whatever names more appropriate for the XML representation.
@MOXmlGlobalType("EmployeeTypeType") @MOXmlNamespaceRef(Employee.class) public enum EmployeeType { commonEmployee, manager, vicePresident }
The following XML schema fragment is generated
<xs:simpleType name="EmployeeTypeType"> <xs:restriction base="xs:string"> <xs:enumeration value="vicePresident"/> <xs:enumeration value="commonEmployee"/> <xs:enumeration value="manager"/> </xs:restriction> </xs:simpleType>
By adding this annotation, we can control the names of the enumerations in the XML representation. For instance, using
@MOXmlGlobalType("EmployeeTypeType") @MOXmlNamespaceRef(Employee.class) public enum EmployeeType { commonEmployee, manager, @MOEnumXmlName("vp") vicePresident }
results in the following schema fragment
<xs:simpleType name="EmployeeTypeType"> <xs:restriction base="xs:string"> <xs:enumeration value="vp"/> <xs:enumeration value="commonEmployee"/> <xs:enumeration value="manager"/> </xs:restriction> </xs:simpleType>
Required Element Summary | |
---|---|
java.lang.String |
value
|
Element Detail |
---|
public abstract java.lang.String value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |