Class AbstractStrategy
java.lang.Object
org.miaixz.bus.extra.captcha.strategy.AbstractStrategy
- All Implemented Interfaces:
Serializable,CodeStrategy
- Direct Known Subclasses:
RandomStrategy
随机字符验证码生成策略
可以通过传入的基础集合和长度随机生成验证码字符
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractStrategy(int count) 构造,使用字母+数字做为基础AbstractStrategy(String baseStr, int length) 构造 -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.extra.captcha.strategy.CodeStrategy
generate, verify
-
Field Details
-
baseStr
基础字符集合,用于随机获取字符串的字符集合 -
length
protected final int length验证码长度
-
-
Constructor Details
-
AbstractStrategy
public AbstractStrategy(int count) 构造,使用字母+数字做为基础- Parameters:
count- 生成验证码长度
-
AbstractStrategy
构造- Parameters:
baseStr- 基础字符集合,用于随机获取字符串的字符集合length- 生成验证码长度
-
-
Method Details
-
getLength
public int getLength()获取长度验证码- Returns:
- 验证码长度
-