Interface CloneStrategyProvider


public interface CloneStrategyProvider
SPI interface for providing custom clone strategies 提供自定义克隆策略的SPI接口

Implementations of this interface can be discovered via ServiceLoader and provide additional cloning strategies beyond the built-in ones.

此接口的实现可以通过ServiceLoader发现,并提供内置策略之外的额外克隆策略。

Usage Examples | 使用示例:

public class CustomStrategyProvider implements CloneStrategyProvider {
    @Override
    public List<CloneStrategy> getStrategies() {
        return List.of(new MyCustomStrategy());
    }

    @Override
    public int priority() {
        return 50; // Higher priority than default
    }
}

To register the provider, create a file: META-INF/services/cloud.opencode.base.deepclone.spi.CloneStrategyProvider

Features | 主要功能:

  • ServiceLoader-based discovery - 基于ServiceLoader的发现
  • Priority-based ordering - 基于优先级排序
  • Custom strategy registration - 自定义策略注册

Security | 安全性:

  • Thread-safe: Implementation dependent - 线程安全: 取决于实现
Since:
JDK 25, opencode-base-deepclone V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the list of clone strategies provided by this provider 获取此提供者提供的克隆策略列表
    default int
    Gets the priority of this provider 获取此提供者的优先级
  • Method Details

    • getStrategies

      List<CloneStrategy> getStrategies()
      Gets the list of clone strategies provided by this provider 获取此提供者提供的克隆策略列表
      Returns:
      the list of strategies | 策略列表
    • priority

      default int priority()
      Gets the priority of this provider 获取此提供者的优先级

      Lower values indicate higher priority. Default is 100.

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

      Returns:
      the priority | 优先级