java.lang.Object
org.miaixz.bus.extra.captcha.strategy.AbstractStrategy
- All Implemented Interfaces:
Serializable,CodeStrategy
- Direct Known Subclasses:
RandomStrategy
Abstract CAPTCHA code generation strategy. Generates a random CAPTCHA string from a given base character set and
length.
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractStrategy(int count) Constructor, using letters and numbers as the base set.AbstractStrategy(String baseStr, int length) Constructor. -
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
The base character set from which to randomly select characters for the CAPTCHA string. -
length
protected final int lengthThe length of the CAPTCHA code.
-
-
Constructor Details
-
AbstractStrategy
public AbstractStrategy(int count) Constructor, using letters and numbers as the base set.- Parameters:
count- The length of the CAPTCHA code to generate.
-
AbstractStrategy
Constructor.- Parameters:
baseStr- The base character set from which to randomly select characters.length- The length of the CAPTCHA code to generate.
-
-
Method Details
-
getLength
public int getLength()Gets the length of the CAPTCHA code.- Returns:
- The length of the CAPTCHA code.
-