add for enable

This commit is contained in:
houbb
2020-01-14 00:29:18 +08:00
parent 2b99548b36
commit e61bacc8a0

View File

@@ -34,6 +34,12 @@ public class SensitiveWordBs {
*/ */
private volatile IWordContext context; private volatile IWordContext context;
/**
* 是否启用数字校验
* @since 0.0.11
*/
private boolean enableNumCheck = true;
/** /**
* DCL 初始化 wordMap 信息 * DCL 初始化 wordMap 信息
* @return 初始化后的结果 * @return 初始化后的结果
@@ -69,9 +75,20 @@ public class SensitiveWordBs {
SensitiveWordBs bs = new SensitiveWordBs(); SensitiveWordBs bs = new SensitiveWordBs();
bs.context = buildDefaultContext(); bs.context = buildDefaultContext();
bs.context.sensitiveNumCheck(bs.enableNumCheck);
return bs; return bs;
} }
/**
* 设置是否启动数字检测
* @param enableNumCheck 数字检测
* @since 0.0.11
*/
public SensitiveWordBs enableNumCheck(boolean enableNumCheck) {
this.enableNumCheck = enableNumCheck;
return this;
}
/** /**
* 构建默认的上下文 * 构建默认的上下文
* @return 结果 * @return 结果
@@ -88,7 +105,7 @@ public class SensitiveWordBs {
wordContext.ignoreRepeat(true); wordContext.ignoreRepeat(true);
// 开启校验 // 开启校验
wordContext.sensitiveNumCheck(true); wordContext.sensitiveNumCheck();
wordContext.sensitiveEmailCheck(true); wordContext.sensitiveEmailCheck(true);
return wordContext; return wordContext;