Annotation Interface CloneIgnore


@Retention(RUNTIME) @Target(FIELD) @Documented public @interface CloneIgnore
Annotation to mark fields that should be ignored during cloning 标记克隆时忽略的字段注解

Fields marked with this annotation will be set to their default value (null/0/false) in the cloned object.

标记此注解的字段在克隆对象中将被设置为默认值(null/0/false)。

Usage Examples | 使用示例:

public class Entity {
    private String id;

    @CloneIgnore(reason = "Cache data, not needed in clone")
    private transient Map<String, Object> cache;
}

Features | 主要功能:

  • Skip annotated fields during cloning - 克隆时跳过注解字段
  • 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 ignoring this field (for documentation) 忽略此字段的原因(用于文档)
  • Element Details

    • reason

      String reason
      Reason for ignoring this field (for documentation) 忽略此字段的原因(用于文档)
      Returns:
      the reason | 原因
      Default:
      ""