I'm trying to generate enums from a simple-type of base int
using the Maven maven-jaxb2-plugin
. But no enum is being generated.
I can see that the generator is using the bindings-file, since it throws errors if it couldn't find a mapping.
When I change the base to string
the enum gets generated (but I'm not allowed to change the base).
So do I have something configured wrong, or is it simply not possible?
xsd-excerpt:
<xs:simpleType name="codeType">
<xs:restriction base="xs:int">
<xs:enumeration value="200"/>
<xs:enumeration value="400"/>
</xs:restriction>
</xs:simpleType>
bindings-file excerpt:
<jaxb:bindings schemaLocation="some.xsd">
<jaxb:bindings node="//xs:simpleType[@name='codeType']/xs:restriction/xs:enumeration[@value='200']">
<jaxb:typesafeEnumMember name="OK" />
</jaxb:bindings>
<jaxb:bindings node="//xs:simpleType[@name='codeType']/xs:restriction/xs:enumeration[@value='400']">
<jaxb:typesafeEnumMember name="BAD_REQUEST" />
</jaxb:bindings>
</jaxb:bindings>