Class EnumHandler

java.lang.Object
cloud.opencode.base.deepclone.handler.EnumHandler
All Implemented Interfaces:
TypeHandler<Enum<?>>

public class EnumHandler extends Object implements TypeHandler<Enum<?>>
Type handler for enum values 枚举值的类型处理器

Enums are inherently immutable singletons, so cloning returns the same instance.

枚举本质上是不可变的单例,因此克隆返回相同的实例。

Since:
JDK 25, opencode-base-deepclone V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • EnumHandler

      public EnumHandler()
  • Method Details

    • clone

      public Enum<?> clone(Enum<?> original, Cloner cloner, CloneContext context)
      Description copied from interface: TypeHandler
      Clones the object 克隆对象
      Specified by:
      clone in interface TypeHandler<Enum<?>>
      Parameters:
      original - the original object | 原始对象
      cloner - the cloner for recursive cloning | 用于递归克隆的克隆器
      context - the clone context | 克隆上下文
      Returns:
      the cloned object | 克隆的对象
    • supports

      public boolean supports(Class<?> type)
      Description copied from interface: TypeHandler
      Checks if this handler supports the given type 检查此处理器是否支持给定类型
      Specified by:
      supports in interface TypeHandler<Enum<?>>
      Parameters:
      type - the type to check | 要检查的类型
      Returns:
      true if supported | 如果支持返回true
    • priority

      public int priority()
      Description copied from interface: TypeHandler
      Gets the priority of this handler 获取此处理器的优先级

      Lower values indicate higher priority. Default is 100.

      较小的值表示较高的优先级。默认值为100。

      Specified by:
      priority in interface TypeHandler<Enum<?>>
      Returns:
      the priority | 优先级