mirror of
https://github.com/houbb/sensitive-word.git
synced 2026-03-22 08:27:36 +08:00
add for enable
This commit is contained in:
@@ -34,6 +34,12 @@ public class SensitiveWordBs {
|
||||
*/
|
||||
private volatile IWordContext context;
|
||||
|
||||
/**
|
||||
* 是否启用数字校验
|
||||
* @since 0.0.11
|
||||
*/
|
||||
private boolean enableNumCheck = true;
|
||||
|
||||
/**
|
||||
* DCL 初始化 wordMap 信息
|
||||
* @return 初始化后的结果
|
||||
@@ -69,9 +75,20 @@ public class SensitiveWordBs {
|
||||
|
||||
SensitiveWordBs bs = new SensitiveWordBs();
|
||||
bs.context = buildDefaultContext();
|
||||
bs.context.sensitiveNumCheck(bs.enableNumCheck);
|
||||
return bs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否启动数字检测
|
||||
* @param enableNumCheck 数字检测
|
||||
* @since 0.0.11
|
||||
*/
|
||||
public SensitiveWordBs enableNumCheck(boolean enableNumCheck) {
|
||||
this.enableNumCheck = enableNumCheck;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建默认的上下文
|
||||
* @return 结果
|
||||
@@ -88,7 +105,7 @@ public class SensitiveWordBs {
|
||||
wordContext.ignoreRepeat(true);
|
||||
|
||||
// 开启校验
|
||||
wordContext.sensitiveNumCheck(true);
|
||||
wordContext.sensitiveNumCheck();
|
||||
wordContext.sensitiveEmailCheck(true);
|
||||
|
||||
return wordContext;
|
||||
|
||||
Reference in New Issue
Block a user