为什么 JAXB 生成的类具有受保护的成员以及如何更改它?
我一直在互联网上搜索 JAXB 生成的类具有受保护成员(所有成员,无论继承如何)的原因。
我希望成员是私人的。
我的搜索结果是空的。
我有普通的 xsd 文件,它们使用 Maven 和 JAXB 转换为 Java 类。理想情况下,生成的成员应该是私有的,但我找不到实现此目的的方法。
有没有办法修改这种默认行为?
I have been searching the internet for a reason why JAXB generated classes have protected members (all of them, regardless of inheritance).
I would like the members to be private instead.
My search has come up empty.
I have normal xsd files which are converted into Java classes using Maven and JAXB. Ideally the generated members should be private but I cannot find a way to achieve this.
Is there a way to modify this default behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我要回答我自己的问题。
创建插件是正确的方法。
我编写了以下插件,它似乎可以工作。
如果您愿意,请随意使用。
Well, I am going to respond to my own question.
Creating a plugin was the right way to go.
I wrote the following plugin and it seems to work.
Feel free to use this if you want.
我认为实现这一点的唯一方法是开发一个 JXC 插件 自己在 google 上搜索示例。
幸运的是,问题所有者开发并分享了该插件。
I think the only way to achieve this is to develop a JXC plugin yourself, search google for samples.
Luckily, question owner has developed and shared the plugin.