Interface FunctionProvider


public interface FunctionProvider
Function Provider SPI 函数提供者SPI

Provides a service provider interface for registering custom functions.

为注册自定义函数提供服务提供者接口。

Features | 主要功能:

  • SPI for pluggable function registration - 可插拔函数注册的SPI
  • Priority-based registration ordering - 基于优先级的注册排序

Usage Examples | 使用示例:

public class MyFunctionProvider implements FunctionProvider {
    @Override
    public Map<String, Function> getFunctions() {
        return Map.of("myfunc", args -> "result");
    }

    @Override
    public int getPriority() {
        return 10;  // Higher priority registered first
    }
}

Security | 安全性:

  • Thread-safe: Depends on implementation - 线程安全: 取决于实现
  • Null-safe: Depends on implementation - 空值安全: 取决于实现
Since:
JDK 25, opencode-base-expression V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the functions provided by this provider 获取此提供者提供的函数
    default int
    Get the priority of this provider 获取此提供者的优先级
  • Method Details

    • getFunctions

      Map<String,Function> getFunctions()
      Get the functions provided by this provider 获取此提供者提供的函数
      Returns:
      the function map | 函数映射
    • getPriority

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

      Higher priority providers are registered first. Default priority is 0.

      优先级更高的提供者先注册。默认优先级为0。

      Returns:
      the priority | 优先级