JAXB: Anonymous simple types as enums?

后端 未结 3 1304
感动是毒
感动是毒 2020-12-16 01:18

When generating Java from an XSD via the XJC compiler, I always get the type java.lang.String for elements with anonymous simpleTypes like this:

    

        
3条回答
  •  没有蜡笔的小新
    2020-12-16 02:10

    I had a very similar question, I asked on the JAXB mailing list and got this fairly helpful response (haven't had time to try it out though)

    edit: if you're talking about automatically generating the enum class, rather than just automatically mapping to an enum class you write yourself, I would think that you could write a java class that would parse the schema file and autogenerate the java code for that enumeration. (then run that java class whenever you call xjc)

提交回复
热议问题