如何从JAXB生成JMX MXBean兼容的java类模型?
从JMX MXBean规范来看,一个java类类型J必须满足
Either 如果 J 至少有一个带 ConstructorProperties 注释的公共构造函数, 或者 如果 J 有一个公共的无参数构造函数,并且对于 J 中类型 T 和名称 N 的每个 getter 都有一个具有相同名称和类型的对应 setter
那么我如何使用 JAXB 生成满足 MXBean 约束的 JAVA 类模型?
谢谢 于
From the JMX MXBean specification, a java class type J must satisfy
Either
if J has at least one public constructor with a ConstructorProperties annotation,
Or
if J has a public no-arg constructor, and for every getter in J with type T and name N there is a corresponding setter with the same name and type
So how can I use JAXB to generate JAVA class model which satisfy the MXBean constrain?
Thanks
YU
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JAXB 满足 getter/setter 约束,不是吗?或者,xjc 满足它。 JAXB本身只是一个框架。
xjc
用于从 XML 模式定义文件生成 Java 代码。至于注释:这个好像没有必要。 JAXB 始终需要一个无参数构造函数来进行解组。
如果这听起来不适合您,也许您可以澄清您的问题(如果合适,可以用一个小例子)。
JAXB satisfies the getter/setter constraint, doesn't it? Or, rather
xjc
satisfies it. JAXB itself is just the framework.xjc
is used to generate Java code from an XML schema definition file.As for the annotation: This doesn't seem to be necessary. JAXB always needs a no-arg constructor for unmarshalling.
If this doesn't sound right to you, maybe you could clarify your question (with a small example if appropriate).