public class MathGenerator extends Object implements CodeGenerator
Constructor and Description |
---|
MathGenerator()
构造
|
MathGenerator(int numberLength)
构造
|
Modifier and Type | Method and Description |
---|---|
String |
generate()
生成验证码
|
int |
getLength()
获取验证码长度
|
boolean |
verify(String code,
String userInputCode)
验证用户输入的字符串是否与生成的验证码匹配
用户通过实现此方法定义验证码匹配方式 |
public MathGenerator()
public MathGenerator(int numberLength)
numberLength
- 参与计算最大数字位数public String generate()
CodeGenerator
generate
in interface CodeGenerator
public boolean verify(String code, String userInputCode)
CodeGenerator
verify
in interface CodeGenerator
code
- 生成的随机验证码userInputCode
- 用户输入的验证码public int getLength()
Copyright © 2024. All rights reserved.