Enum Class CaptchaStrength

java.lang.Object
java.lang.Enum<CaptchaStrength>
cloud.opencode.base.captcha.support.CaptchaStrength
All Implemented Interfaces:
Serializable, Comparable<CaptchaStrength>, Constable

public enum CaptchaStrength extends Enum<CaptchaStrength>
Captcha Strength - CAPTCHA difficulty levels 验证码强度 - 验证码难度级别

This enum defines difficulty levels for CAPTCHA generation.

此枚举定义了验证码生成的难度级别。

Features | 主要功能:

  • Four difficulty levels (EASY, MEDIUM, HARD, EXTREME) - 四个难度级别
  • Configurable noise, line, and length parameters - 可配置噪点、线条和长度参数

Usage Examples | 使用示例:

CaptchaStrength strength = CaptchaStrength.MEDIUM;
CaptchaConfig config = strength.toConfig();

Security | 安全性:

  • Thread-safe: Yes (immutable enum) - 线程安全: 是(不可变枚举)
  • Null-safe: N/A - 空值安全: 不适用
Since:
JDK 25, opencode-base-captcha V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Enum Constant Details

    • EASY

      public static final CaptchaStrength EASY
      Easy - Minimal noise, clear text 简单 - 最少噪点,清晰文本
    • MEDIUM

      public static final CaptchaStrength MEDIUM
      Medium - Moderate noise and distortion 中等 - 适中噪点和干扰
    • HARD

      public static final CaptchaStrength HARD
      Hard - Heavy noise and distortion 困难 - 大量噪点和干扰
    • EXTREME

      public static final CaptchaStrength EXTREME
      Extreme - Maximum noise and distortion 极难 - 最大噪点和干扰
  • Method Details

    • values

      public static CaptchaStrength[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CaptchaStrength valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getNoiseLines

      public int getNoiseLines()
      Gets the number of noise lines. 获取干扰线数量。
      Returns:
      the noise lines count | 干扰线数量
    • getNoiseDots

      public int getNoiseDots()
      Gets the number of noise dots. 获取干扰点数量。
      Returns:
      the noise dots count | 干扰点数量
    • getFontSize

      public float getFontSize()
      Gets the font size. 获取字体大小。
      Returns:
      the font size | 字体大小
    • isRandomFontPerChar

      public boolean isRandomFontPerChar()
      Returns whether each character uses a random different font. 返回每个字符是否使用随机不同字体。
      Returns:
      true if random font per character is enabled | 是否启用每字符随机字体
    • isBezierNoiseEnabled

      public boolean isBezierNoiseEnabled()
      Returns whether Bezier curve noise is enabled. 返回是否启用贝塞尔穿字噪声。
      Returns:
      true if Bezier noise is enabled | 是否启用贝塞尔噪声
    • isSineWarpEnabled

      public boolean isSineWarpEnabled()
      Returns whether sine wave warp is enabled. 返回是否启用正弦波变形。
      Returns:
      true if sine warp is enabled | 是否启用正弦波变形
    • isOutlineShadowEnabled

      public boolean isOutlineShadowEnabled()
      Returns whether character outline shadow is enabled. 返回是否启用字符轮廓阴影。
      Returns:
      true if outline shadow is enabled | 是否启用轮廓阴影
    • getCharOverlapRatio

      public float getCharOverlapRatio()
      Gets the character overlap ratio. 获取字符重叠比例。
      Returns:
      the overlap ratio (0.0-0.5) | 重叠比例(0.0-0.5)
    • applyTo

      public CaptchaConfig.Builder applyTo(CaptchaConfig.Builder builder)
      Applies this strength to a configuration builder. 将此强度应用到配置构建器。
      Parameters:
      builder - the configuration builder | 配置构建器
      Returns:
      the builder | 构建器
    • toConfig

      public CaptchaConfig toConfig()
      Creates a configuration with this strength. 使用此强度创建配置。
      Returns:
      the configuration | 配置