I have simpleType Enum which is behaving differently when generating JAXB classes from the below schema:
<xsd:element name="genderCode" type="GenderCodeType" minOccurs="0" />
<xsd:simpleType name="GenderCodeType" >
<xsd:restriction base="xsd:string">
<xsd:enumeration value="F" />
<xsd:enumeration value="M" />
</xsd:restriction>
</xsd:simpleType>
It generates:
@XmlElement
protected String genderCode;
where as this one below generated actual enum type:
<xsd:element name="genderCode" type="base:Gender" minOccurs="0" />
<xsd:simpleType name="Gender">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="M"/>
<xsd:enumeration value="F"/>
<xsd:enumeration value="U"/>
</xsd:restriction>
</xsd:simpleType>
...
@XmlType(name = "Gender")
@XmlEnum
public enum Gender {
M, F, U;
public String value() {
return name();
}
public static Gender fromValue(String v) {
return valueOf(v);
}
}
...
@XmlElement
protected Gender genderCode;