java - XJC - 它是可扩展的吗?

标签 java jaxb xsd xjc

这个问题与JAXB2 type restriction not working?有关.我想扩展 XJC 以支持类型限制。它就像覆盖父类(super class)的字段定义一样简单。

有什么办法可以正确地做到这一点?有钩子(Hook)吗?有没有类似的工具?

最佳答案

,XJC is extensible使用插件:

What can a plugin do?

A JAXB RI plugin participates in the code generation from a schema. It can define its own customizations that users can use to control it, it can access the code that the JAXB RI generates, and it can generate additional classes/methods/fields/annotations/comments.

A plugin can also choose to take over the XJC's code generation process completely. Only one plugin can do this at any given time, but this allows a plugin to generate radically different code from a schema.

另请参阅此答案:

What is the role of ClassOutline / JClass / CClass in CodeModel?

但不,我认为这不是解决 the problem 的正确方法你有。

尝试找出绑定(bind)或修补模式。

关于java - XJC - 它是可扩展的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26619375/

相关文章:

java - 通过 org.w3c.dom API 公开 JAXB 注解的对象

foreign-keys - xml 模式中的主键和外键

java - for/break 比 iterator().next() 更高效吗?

java - iText 矩形如何使用setBorderColorxxx 设置颜色 |如何向矩形添加文本

java - 具有可变根元素名称的 JAXB 编码通用列表

java - JAXB 是否支持内联元素?

c++ - 如何将 CodeSynthesis-XSD 包含到自己的应用程序中?

java - 如何使用通用类通过 maven 从 xsd 生成 JAXB

Java 如何通过打开图像来启动myapp?

java - 正则表达式:格式化/多种格式