2011-07-27 57 views
4

我遇到麻烦让类重新生成。我JAXB:防止类重新生成

我有一个模式A,其在模式B.架构B导入在模式C.

然后导入在模式A中,我有两个simpleTypes,其是字符串的枚举:

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

我有其他类型(复合类型,以及非枚举simpleTypes),用于这一切都很好。

感谢您的帮助。

回答

1
+0

谢谢,我会考虑它。 – ins

+1

我正试图找到我需要的解决方法。我只是想确定java枚举不在.episode文件中,并且仍然是重新生成的。我注意到这个问题只发生在这些枚举上.. – ins

+0

我知道,这篇文章很旧,但我找不到解决方案来保留枚举的生成。你找到了什么? – D051P0