Interface SaGenerateUniqueTokenFunction

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SaGenerateUniqueTokenFunction
生成唯一式 token 的函数式接口,方便开发者进行 lambda 表达式风格调用

参数:元素名称, 最大尝试次数, 创建 token 函数, 检查 token 函数

返回:生成的token

Since:
1.35.0
Author:
click33
  • Method Summary

    Modifier and Type
    Method
    Description
    execute(String elementName, int maxTryTimes, Supplier<String> createTokenFunction, Function<String,Boolean> checkTokenFunction)
    封装 token 生成、校验的代码,生成唯一式 token
  • Method Details

    • execute

      String execute(String elementName, int maxTryTimes, Supplier<String> createTokenFunction, Function<String,Boolean> checkTokenFunction)
      封装 token 生成、校验的代码,生成唯一式 token
      Parameters:
      elementName - 要生成的元素名称,方便抛出异常时组织提示信息
      maxTryTimes - 最大尝试次数
      createTokenFunction - 创建 token 的函数
      checkTokenFunction - 校验 token 是否唯一的函数(返回 true 表示唯一,可用)
      Returns:
      最终生成的唯一式 token