Interface CloneListener


public interface CloneListener
Listener interface for clone lifecycle events 克隆生命周期事件的监听器接口

Implementations can observe and react to events during the cloning process, such as before and after an object is cloned, or when an error occurs.

实现可以观察和响应克隆过程中的事件,如对象克隆前后,或发生错误时。

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

    Modifier and Type
    Method
    Description
    default void
    afterClone(Object original, Object cloned, CloneContext context)
    Called after an object is cloned 在对象克隆之后调用
    default void
    beforeClone(Object original, CloneContext context)
    Called before an object is cloned 在对象克隆之前调用
    default void
    onError(Object original, Throwable error, CloneContext context)
    Called when a clone error occurs 当克隆错误发生时调用
  • Method Details

    • beforeClone

      default void beforeClone(Object original, CloneContext context)
      Called before an object is cloned 在对象克隆之前调用
      Parameters:
      original - the original object | 原始对象
      context - the clone context | 克隆上下文
    • afterClone

      default void afterClone(Object original, Object cloned, CloneContext context)
      Called after an object is cloned 在对象克隆之后调用
      Parameters:
      original - the original object | 原始对象
      cloned - the cloned object | 克隆的对象
      context - the clone context | 克隆上下文
    • onError

      default void onError(Object original, Throwable error, CloneContext context)
      Called when a clone error occurs 当克隆错误发生时调用
      Parameters:
      original - the original object | 原始对象
      error - the error | 错误
      context - the clone context | 克隆上下文