JAXB:防止类被重新生成 [英] JAXB: Prevent classes from being regenerated

查看:31
本文介绍了JAXB:防止类被重新生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm having troubles keeping classes from being regenerated. I'm

我有一个模式 A,它被导入到模式 B 中.然后模式 B 被导入到模式 C.

I have a schema A, which is imported in schema B. Schema B is then imported in Schema C.

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

In schema A, I have two simpleTypes, which are enumerations of strings:

<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)

Theses produces generated classes. In schema C, the classes corresponding to these enumerations keep being regenerated, and of course in the wrong place. I'm adding references to existing classes this way : (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),一切都很好.

I have other types (complexTypes, and non enumeration simpleTypes) for which everything is fine.

感谢您的帮助.

推荐答案

可以使用情节文件进行模块化架构编译:

You can use episode files to do modular schema compilation:

这篇关于JAXB:防止类被重新生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆