Class OptionalHandler

java.lang.Object
cloud.opencode.base.deepclone.handler.OptionalHandler
All Implemented Interfaces:
TypeHandler<Optional>

public class OptionalHandler extends Object implements TypeHandler<Optional>
Type handler for Optional values Optional值的类型处理器

Deep clones the content of an Optional, preserving the empty/present state.

深度克隆Optional的内容,保持空/存在状态。

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

    • OptionalHandler

      public OptionalHandler()
  • Method Details

    • clone

      public Optional clone(Optional original, Cloner cloner, CloneContext context)
      Description copied from interface: TypeHandler
      Clones the object 克隆对象
      Specified by:
      clone in interface TypeHandler<Optional>
      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<Optional>
      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<Optional>
      Returns:
      the priority | 优先级