Class ArrayHandler
java.lang.Object
cloud.opencode.base.deepclone.handler.ArrayHandler
- All Implemented Interfaces:
TypeHandler<Object>
Handler for cloning array types
数组类型克隆处理器
Handles both primitive arrays (int[], double[], etc.) and object arrays. Primitive arrays are copied directly, object arrays have their elements deep cloned.
处理基本类型数组(int[]、double[]等)和对象数组。 基本类型数组直接复制,对象数组的元素会被深度克隆。
Usage Examples | 使用示例:
ArrayHandler handler = new ArrayHandler();
int[] intArray = {1, 2, 3};
int[] clonedInt = (int[]) handler.clone(intArray, cloner, context);
String[] strArray = {"a", "b", "c"};
String[] clonedStr = (String[]) handler.clone(strArray, cloner, context);
Features | 主要功能:
- Primitive array direct copy - 基本类型数组直接复制
- Object array recursive deep clone - 对象数组递归深度克隆
- Preserves array component type - 保留数组组件类型
Security | 安全性:
- Thread-safe: Yes (stateless) - 线程安全: 是(无状态)
- Since:
- JDK 25, opencode-base-deepclone V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone(Object array, Cloner cloner, CloneContext context) Clones the object 克隆对象<T> T[]cloneObjectArray(T[] array, Cloner cloner, CloneContext context) Clones an object array 克隆对象数组clonePrimitiveArray(Object array) Clones a primitive array (convenience method) 克隆基本类型数组(便捷方法)clonePrimitiveArray(Object array, Class<?> componentType, int length) Clones a primitive type array 克隆基本类型数组intpriority()Gets the priority of this handler 获取此处理器的优先级booleanChecks if this handler supports the given type 检查此处理器是否支持给定类型
-
Constructor Details
-
ArrayHandler
public ArrayHandler()
-
-
Method Details
-
clone
Description copied from interface:TypeHandlerClones the object 克隆对象- Specified by:
clonein interfaceTypeHandler<Object>- Parameters:
array- the original object | 原始对象cloner- the cloner for recursive cloning | 用于递归克隆的克隆器context- the clone context | 克隆上下文- Returns:
- the cloned object | 克隆的对象
-
clonePrimitiveArray
-
clonePrimitiveArray
-
cloneObjectArray
Clones an object array 克隆对象数组- Type Parameters:
T- the element type | 元素类型- Parameters:
array- the original array | 原始数组cloner- the cloner | 克隆器context- the context | 上下文- Returns:
- the cloned array | 克隆的数组
-
supports
Description copied from interface:TypeHandlerChecks if this handler supports the given type 检查此处理器是否支持给定类型- Specified by:
supportsin interfaceTypeHandler<Object>- Parameters:
type- the type to check | 要检查的类型- Returns:
- true if supported | 如果支持返回true
-
priority
public int priority()Description copied from interface:TypeHandlerGets the priority of this handler 获取此处理器的优先级Lower values indicate higher priority. Default is 100.
较小的值表示较高的优先级。默认值为100。
- Specified by:
priorityin interfaceTypeHandler<Object>- Returns:
- the priority | 优先级
-