我有以下生成的枚举类型。我遇到的问题是,由于某种原因(可能是大写),在 NCBonus 值中插入了下划线。
我想知道在生成枚举时如何防止这种情况发生。
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="PromoType">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="MEM"/>
* <enumeration value="COU"/>
* <enumeration value="CHA"/>
* <enumeration value="SAD"/>
* <enumeration value="NCBonus"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "PromoType")
@XmlEnum
public enum PromoType {
MEM("MEM"),
COU("COU"),
CHA("CHA"),
SAD("SAD"),
@XmlEnumValue("NCBonus")
NC_BONUS("NCBonus");
我试过使用全局绑定选项
<jxb:globalBindings underscoreBinding="asCharInWord" xmlns:xs="http://www.w3.org/2001/XMLSchema">
这会对其他对象产生不良后果,但与枚举类型没有什么不同。
另外我尝试过使用
<jaxb:bindings schemaLocation="../schemas/insurance_service_model.xsd" node="//xs:schema">
<jaxb:bindings node="xs:simpleType[@name='PromoType']">
<jaxb:typesafeEnumMember name="NCBonus" value="NCBonus"/>
一切都无济于事。
有人可以告诉我如何实现这个目标。