具有多个参数的枚举的XSD表示形式

时间:2019-01-21 14:48:52

标签: java xsd jaxb enumeration xjc

我具有以下模板的Java枚举类,我打算使用xjc生成它。有没有办法在xsd中捕获以下枚举的多个参数(firstValue,secondValue ..传递给构造函数)?

public enum XYZ{
    CONSTANT1("A","B","C),
    CONSTANT2("E","F","G");

    private String firstValue, secondValue, thirdValue;
    //...getters() go here...
    XYZ(String firstvalue, String secondValue, thirdValue)
    {
     ...
    }
}

xsd枚举类型当前只能接受一个值:

<xs:simpleType>
 <xs:annotation><xs:appinfo>
 <jaxb:typesafeEnumClass>
     <jaxb:typesafeEnumMember name="CONSTANT1" value="A">
     <jaxb:typesafeEnumMember name="CONSTANT2" value="D">
 </jaxb:typesafeEnumClass>
 </xs:annotation></xs:appinfo>
 <xs:restriction base="xs:string">
     <xs:enumeration value="A"/>
     <xs:enumeration value="D"/>
 </xs:restriction>
</xs:simpleType>

如何在xsd中存储B,C,E,F等其他值以生成此类枚举类?

0 个答案:

没有答案