Annotation Interface CloneDeep


@Retention(RUNTIME) @Target(FIELD) @Documented public @interface CloneDeep
Annotation to force deep cloning of a field 标记强制深度克隆的字段注解

Fields marked with this annotation will always be deeply cloned, even if the type would normally be treated as immutable.

标记此注解的字段将始终被深度克隆,即使该类型通常被视为不可变类型。

Usage Examples | 使用示例:

public class Entity {
    @CloneDeep(reason = "Mutable wrapper that needs deep copy")
    private LocalDateTime modifiedTime;
}

Features | 主要功能:

  • Force deep cloning of annotated fields - 强制深度克隆注解字段
  • Runtime retention for reflection - 运行时保留用于反射

Security | 安全性:

  • Thread-safe: Yes (annotation is immutable) - 线程安全: 是(注解不可变)
Since:
JDK 25, opencode-base-deepclone V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Reason for forcing deep clone (for documentation) 强制深拷贝的原因(用于文档)
  • Element Details

    • reason

      String reason
      Reason for forcing deep clone (for documentation) 强制深拷贝的原因(用于文档)
      Returns:
      the reason | 原因
      Default:
      ""