Interface DeepCloneable<T>
- Type Parameters:
T- the type of the cloned object | 克隆对象的类型
public interface DeepCloneable<T>
Contract interface for objects that support deep cloning
支持深度克隆的对象契约接口
Classes implementing this interface can provide custom deep clone logic, which will be used by the cloner instead of reflection-based cloning.
实现此接口的类可以提供自定义深度克隆逻辑,克隆器将使用该逻辑而非基于反射的克隆。
Usage Examples | 使用示例:
public class Product implements DeepCloneable<Product> {
private String id;
private String name;
private List<String> tags;
@Override
public Product deepClone() {
Product copy = new Product();
copy.id = this.id;
copy.name = this.name;
copy.tags = new ArrayList<>(this.tags);
return copy;
}
}
Features | 主要功能:
- Custom deep clone logic - 自定义深度克隆逻辑
- Cloner integration - 克隆器集成
- Type-safe contract - 类型安全契约
Security | 安全性:
- Thread-safe: Implementation dependent - 线程安全: 取决于实现
- Since:
- JDK 25, opencode-base-deepclone V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
-
Method Details
-
deepClone
T deepClone()Performs a deep clone of this object 执行此对象的深度克隆- Returns:
- a deep copy of this object | 此对象的深度副本
-
deepClone
-