【问题标题】:JAXB: Prevent classes from being regeneratedJAXB:防止重新生成类
【发布时间】:2011-07-27 08:55:17
【问题描述】:

我在阻止类重新生成时遇到了麻烦。我是

我有一个架构 A,它被导入到架构 B 中。然后架构 B 被导入到架构 C 中。

在模式 A 中,我有两个 simpleType,它们是字符串的枚举:

<xs:simpleType name="blah_type">
<xs:restriction base="xs:string">
        <xs:enumeration value="blah_1"/>
        <xs:enumeration value="blah_2"/>
        <xs:enumeration value="blah_3"/>
        <xs:enumeration value="blah_4"/>
        <xs:enumeration value="blah_5"/>
    </xs:restriction>
</xs:simpleType>


<xs:simpleType name="another_blah_type">
    <xs:restriction base="xs:string">
        <xs:enumeration value="another_blah_1"/>
        <xs:enumeration value="another_blah_2"/>
        <xs:enumeration value="another_blah_3"/>
        <xs:enumeration value="another_blah_4"/>
        <xs:enumeration value="another_blah_5"/>
    </xs:restriction>
</xs:simpleType>

论文生成生成的类。在模式 C 中,与这些枚举相对应的类不断被重新生成,当然在错误的地方。我以这种方式添加对现有类的引用:(jaxb-creating-modules-for-reuse)

<jaxb:bindings  node="//xs:simpleType[@name='blah_type']">
    <jaxb:class ref="com.stuff.otherstuff.really.deep.BlahType"/>
</jaxb:bindings>

我还有其他类型(complexTypes 和非枚举 simpleTypes),一切都很好。

感谢您的帮助。

【问题讨论】:

    标签: xsd jaxb


    【解决方案1】:

    【讨论】:

    • 我正在尝试找到我需要的解决方法。我只是想明确一点,Java 枚举不在 .episode 文件中,并且仍在重新生成。我注意到问题仅发生在这些枚举中..
    • 我知道,这篇文章很旧,但我找不到保留枚举生成的解决方案。你找到什么了吗?
    • 我的问题现在得到了解答 - Here 就是这样,它是如何工作的。
    猜你喜欢
    • 2016-12-13
    • 1970-01-01
    • 2020-01-07
    • 2011-02-15
    • 2021-07-25
    • 1970-01-01
    • 1970-01-01
    • 2019-11-17
    • 1970-01-01
    相关资源
    最近更新 更多