Class CaptchaConfig
java.lang.Object
cloud.opencode.base.captcha.CaptchaConfig
Captcha Configuration - Configuration for CAPTCHA generation
验证码配置 - 验证码生成配置
This class provides a fluent builder API for configuring CAPTCHA generation.
此类提供用于配置验证码生成的流式构建器 API。
Features | 主要功能:
- Fluent builder API for configuration - 流式构建器 API 配置
- Default values for all settings - 所有设置的默认值
- Support for image dimensions, fonts, noise, and expiration - 支持图像尺寸、字体、噪点和过期
- GIF animation settings (frame count, delay) - GIF 动画设置(帧数、延迟)
Usage Examples | 使用示例:
CaptchaConfig config = CaptchaConfig.builder()
.width(200)
.height(80)
.length(6)
.type(CaptchaType.ALPHANUMERIC)
.expireTime(Duration.ofMinutes(5))
.build();
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: No (some fields may be null if not set) - 空值安全: 否(某些字段未设置时可能为空)
- Since:
- JDK 25, opencode-base-captcha V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classConfiguration Builder 配置构建器 -
Method Summary
Modifier and TypeMethodDescriptionstatic CaptchaConfig.Builderbuilder()Creates a builder for configuration.static CaptchaConfigdefaults()Creates a default configuration.Color[]floatintintintintintintgetType()intgetWidth()booleanCreates a builder from this configuration.
-
Method Details
-
defaults
Creates a default configuration. 创建默认配置。- Returns:
- the default config | 默认配置
-
builder
Creates a builder for configuration. 创建配置构建器。- Returns:
- a new builder | 新构建器
-
toBuilder
Creates a builder from this configuration. 从此配置创建构建器。- Returns:
- a builder with current values | 具有当前值的构建器
-
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getLength
public int getLength() -
getType
-
getExpireTime
-
getNoiseLines
public int getNoiseLines() -
getNoiseDots
public int getNoiseDots() -
getFontSize
public float getFontSize() -
getFontName
-
getBackgroundColor
-
getFontColors
-
isCaseSensitive
public boolean isCaseSensitive() -
getGifFrameCount
public int getGifFrameCount() -
getGifDelay
public int getGifDelay()
-