Annotation Interface JsonBackReference
JSON Back Reference - Marks the Back Part of a Bidirectional Relationship
JSON 反向引用 - 标记双向关系的反向部分
This annotation marks the "child" (back) side of a bidirectional relationship.
The annotated property is not serialized, but is restored
during deserialization by linking back to the parent object marked with
JsonManagedReference.
此注解标记双向关系的"子"(反向)一侧。被注解的属性不会被序列化,
但在反序列化时会通过链接回被 JsonManagedReference 标记的父对象来恢复。
Example | 示例:
public class Parent {
@JsonManagedReference
private List<Child> children;
}
public class Child {
@JsonBackReference
private Parent parent;
}
Features | 主要功能:
- Omitted from serialization output - 从序列化输出中省略
- Restored during deserialization via the forward reference - 反序列化时通过正向引用恢复
- Value must match the paired @JsonManagedReference - value 必须与配对的 @JsonManagedReference 匹配
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Null-safe: N/A - 空值安全: 不适用
- Since:
- JDK 25, opencode-base-json V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe logical name of the reference, must match the correspondingJsonManagedReference.
-
Element Details
-
value
String valueThe logical name of the reference, must match the correspondingJsonManagedReference. 引用的逻辑名称,必须与对应的JsonManagedReference匹配。- Returns:
- the reference name - 引用名称
- Default:
"defaultReference"
-