Annotation Interface JsonManagedReference
JSON Managed Reference - Marks the Forward Part of a Bidirectional Relationship
JSON 管理引用 - 标记双向关系的正向部分
This annotation marks the "parent" (forward) side of a bidirectional relationship.
The annotated property is serialized normally. It works in pair with
JsonBackReference to handle parent-child relationships without
causing infinite recursion during serialization.
此注解标记双向关系的"父"(正向)一侧。被注解的属性正常序列化。
它与 JsonBackReference 配对使用,以处理父子关系,
避免序列化时出现无限递归。
Example | 示例:
public class Parent {
@JsonManagedReference
private List<Child> children;
}
public class Child {
@JsonBackReference
private Parent parent;
}
Features | 主要功能:
- Serialized normally as the forward reference - 作为正向引用正常序列化
- Paired with @JsonBackReference by matching value - 通过匹配 value 与 @JsonBackReference 配对
- Prevents infinite recursion in bidirectional relationships - 防止双向关系中的无限递归
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, used to match withJsonBackReference.
-
Element Details
-
value
String valueThe logical name of the reference, used to match withJsonBackReference. 引用的逻辑名称,用于与JsonBackReference匹配。- Returns:
- the reference name - 引用名称
- Default:
"defaultReference"
-