Class OpenCaptcha.Builder

java.lang.Object
cloud.opencode.base.captcha.OpenCaptcha.Builder
Enclosing class:
OpenCaptcha

public static final class OpenCaptcha.Builder extends Object
OpenCaptcha Builder OpenCaptcha 构建器
Since:
JDK 25, opencode-base-captcha V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • store

      public OpenCaptcha.Builder store(CaptchaStore store)
      Sets the CAPTCHA store. 设置验证码存储。
      Parameters:
      store - the store | 存储
      Returns:
      this builder | 此构建器
    • config

      public OpenCaptcha.Builder config(CaptchaConfig config)
      Sets the configuration. 设置配置。
      Parameters:
      config - the configuration | 配置
      Returns:
      this builder | 此构建器
    • type

      public OpenCaptcha.Builder type(CaptchaType type)
      Sets the CAPTCHA type. 设置验证码类型。
      Parameters:
      type - the type | 类型
      Returns:
      this builder | 此构建器
    • validator

      public OpenCaptcha.Builder validator(CaptchaValidator validator)
      Sets a custom validator. 设置自定义验证器。
      Parameters:
      validator - the validator | 验证器
      Returns:
      this builder | 此构建器
    • metrics

      public OpenCaptcha.Builder metrics(CaptchaMetrics metrics)
      Sets the metrics collector. 设置指标收集器。
      Parameters:
      metrics - the metrics collector | 指标收集器
      Returns:
      this builder | 此构建器
    • eventListener

      public OpenCaptcha.Builder eventListener(CaptchaEventListener eventListener)
      Sets the event listener. 设置事件监听器。
      Parameters:
      eventListener - the event listener | 事件监听器
      Returns:
      this builder | 此构建器
    • build

      public OpenCaptcha build()
      Builds the OpenCaptcha instance. 构建 OpenCaptcha 实例。
      Returns:
      the OpenCaptcha instance | OpenCaptcha 实例
      Throws:
      IllegalStateException - if a HashedCaptchaStore is paired with a non-HashedCaptchaValidator (use auto-detection or CaptchaValidator.hashed()) | 如果 HashedCaptchaStore 搭配了非 HashedCaptchaValidator(请使用自动检测或 CaptchaValidator.hashed())