Annotation Interface XmlValue


@Retention(RUNTIME) @Target({FIELD,METHOD}) @Documented public @interface XmlValue
XML Value Annotation - Maps a field to element text content XML 值注解 - 将字段映射到元素文本内容

This annotation marks a field to receive the text content of the element.

此注解标记字段接收元素的文本内容。

Features | 主要功能:

  • Map a field to element text content - 将字段映射到元素文本内容
  • Combine with @XmlAttribute for mixed content elements - 与 @XmlAttribute 组合用于混合内容元素

Usage Examples | 使用示例:

@XmlRoot("item")
public class Item {
    @XmlAttribute("id")
    private Long id;

    @XmlValue
    private String content; // receives element text
}

// XML: <item id="1">Some content here</item>

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: