@XmlElementWrapper for unwrapped collections(@XmlElementWrapper 用于未包装的集合)
问题描述
文档声明 @XmlElementWrapper 注释可用于未包装"或包装"集合.
The docs state the the @XmlElementWrapper annotation can be used for 'unwrapped' or 'wrapped' collections.
http://docs.oracle.com/javaee/5/api/javax/xml/bind/annotation/XmlElementWrapper.html
如何配置它以生成未包装的集合?
How do you configure it to produce an unwrapped collection?
推荐答案
如果你包含 @XmlElementWrapper
它将添加一个分组元素:
If you include @XmlElementWrapper
it will add a grouping element:
@XmlElementWrapper
@XmlElement(name="foo")
public List<Foo> getFoos() {
return foos;
}
<root>
<foos>
<foo/>
<foo/>
</foos>
</foo>
如果你省略它,那么它就不会.
and if you omit it, then it won't.
@XmlElement(name="foo")
public List<Foo> getFoos() {
return foos;
}
<root>
<foo/>
<foo/>
</foo>
更多信息
- http://blog.bdoughan.com/2012/12/jaxb-representing-null-and-empty.html
这篇关于@XmlElementWrapper 用于未包装的集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:@XmlElementWrapper 用于未包装的集合


- Jersey REST 客户端:发布多部分数据 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01