Class OpenCaptcha.Builder
java.lang.Object
cloud.opencode.base.captcha.OpenCaptcha.Builder
- Enclosing class:
OpenCaptcha
OpenCaptcha Builder
OpenCaptcha 构建器
- Since:
- JDK 25, opencode-base-captcha V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the OpenCaptcha instance.config(CaptchaConfig config) Sets the configuration.eventListener(CaptchaEventListener eventListener) Sets the event listener.metrics(CaptchaMetrics metrics) Sets the metrics collector.store(CaptchaStore store) Sets the CAPTCHA store.type(CaptchaType type) Sets the CAPTCHA type.validator(CaptchaValidator validator) Sets a custom validator.
-
Method Details
-
store
Sets the CAPTCHA store. 设置验证码存储。- Parameters:
store- the store | 存储- Returns:
- this builder | 此构建器
-
config
Sets the configuration. 设置配置。- Parameters:
config- the configuration | 配置- Returns:
- this builder | 此构建器
-
type
Sets the CAPTCHA type. 设置验证码类型。- Parameters:
type- the type | 类型- Returns:
- this builder | 此构建器
-
validator
Sets a custom validator. 设置自定义验证器。- Parameters:
validator- the validator | 验证器- Returns:
- this builder | 此构建器
-
metrics
Sets the metrics collector. 设置指标收集器。- Parameters:
metrics- the metrics collector | 指标收集器- Returns:
- this builder | 此构建器
-
eventListener
Sets the event listener. 设置事件监听器。- Parameters:
eventListener- the event listener | 事件监听器- Returns:
- this builder | 此构建器
-
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())
-