Annotation Interface XmlElementList
XML Element List Annotation - Maps a collection to wrapped XML elements
XML 元素列表注解 - 将集合映射到包装的 XML 元素
This annotation specifies how a collection should be mapped to XML with an optional wrapper element.
此注解指定如何将集合映射到带有可选包装元素的 XML。
Features | 主要功能:
- Map collections to XML element lists - 将集合映射到 XML 元素列表
- Optional wrapper element support - 可选包装元素支持
- Custom item element naming - 自定义项目元素命名
Usage Examples | 使用示例:
@XmlRoot("user")
public class User {
@XmlElementList(value = "roles", itemName = "role")
private List<String> roles;
// Produces: <roles><role>admin</role><role>user</role></roles>
@XmlElementList(itemName = "tag")
private List<String> tags;
// Produces: <tag>java</tag><tag>xml</tag>
}
Security | 安全性:
- Thread-safe: Yes (annotation is immutable) - 线程安全: 是(注解不可变)
- Null-safe: N/A (annotation type) - 空值安全: 不适用(注解类型)
- Since:
- JDK 25, opencode-base-xml V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
String valueThe wrapper element name. 包装元素名称。- Returns:
- the wrapper name, empty means no wrapper | 包装器名称,空表示无包装器
- Default:
""
-
itemName
-