Interface TypeHandler<T>
- Type Parameters:
T- the type this handler processes | 此处理器处理的类型
- All Known Implementing Classes:
ArrayHandler, CollectionHandler, EnumHandler, MapHandler, OptionalHandler, RecordHandler
public interface TypeHandler<T>
Interface for type-specific clone handlers
特定类型克隆处理器接口
Implementations provide specialized cloning logic for specific types, such as arrays, collections, maps, or records.
实现为特定类型提供专门的克隆逻辑,如数组、集合、Map或Record。
Features | 主要功能:
- Type-specific cloning - 特定类型克隆
- Priority-based ordering - 基于优先级排序
- Recursive cloning support - 递归克隆支持
Usage Examples | 使用示例:
public class DateHandler implements TypeHandler<LocalDateTime> {
@Override
public LocalDateTime clone(LocalDateTime original, Cloner cloner, CloneContext context) {
return original; // Immutable, return same reference
}
@Override
public boolean supports(Class<?> type) {
return LocalDateTime.class.isAssignableFrom(type);
}
}
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
-
clone
Clones the object 克隆对象- Parameters:
original- the original object | 原始对象cloner- the cloner for recursive cloning | 用于递归克隆的克隆器context- the clone context | 克隆上下文- Returns:
- the cloned object | 克隆的对象
-
supports
Checks if this handler supports the given type 检查此处理器是否支持给定类型- Parameters:
type- the type to check | 要检查的类型- Returns:
- true if supported | 如果支持返回true
-
priority
default int priority()Gets the priority of this handler 获取此处理器的优先级Lower values indicate higher priority. Default is 100.
较小的值表示较高的优先级。默认值为100。
- Returns:
- the priority | 优先级
-