XJC超级接口和超类只适用于所有类? [英] XJC superinterface and superclass only for all classes?
问题描述
我正在尝试在一个从xsd文件生成的java类中自动实现一个接口。
I'm trying to automatically implement an interface in one java class generated from a xsd file.
This looks as if it could do that, but it will only add implements SomeInterface
to all classes, which is completly stupid. Am I missing something or can you only do this for all classes? Doesn't really make too much sence to let all generated classes implement the same interface. Can I use this feature for one class only?
推荐答案
你可以使用继承扩展。这适用于特定的类(即 xsd:complexType
s)
You could use Inheritance extension provided by JAXB2 Basics Plugins. This works for particular classes (i.e. xsd:complexType
s)
这个问题的答案中也有描述: 生成实现接口的JAXB类
This is also described in answers of this question: Generating a JAXB class that implements an interface
这篇关于XJC超级接口和超类只适用于所有类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!