From 55089dbb258663ecf474265aa68e3d99e949649e Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Fri, 24 Feb 2023 11:49:13 +0800 Subject: [PATCH] bugfix. --- .../plusone/validator/StringValidator.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/xyz/zhouxy/plusone/validator/StringValidator.java b/src/main/java/xyz/zhouxy/plusone/validator/StringValidator.java index e3c51c5..b833533 100644 --- a/src/main/java/xyz/zhouxy/plusone/validator/StringValidator.java +++ b/src/main/java/xyz/zhouxy/plusone/validator/StringValidator.java @@ -1,5 +1,6 @@ package xyz.zhouxy.plusone.validator; +import java.util.Collection; import java.util.List; import java.util.function.Function; import java.util.function.Supplier; @@ -58,18 +59,18 @@ public class StringValidator extends PropertyValidator matchesOr(List regexs, String errMsg) { + public StringValidator matchesOr(List regexs, String errMsg) { return matchesOr(regexs, convertExceptionCreator(errMsg)); } public StringValidator matchesOr( - List regexs, + List regexs, Supplier exceptionCreator) { return matchesOr(regexs, convertExceptionCreator(exceptionCreator)); } public StringValidator matchesOr( - List regexs, + List regexs, Function exceptionCreator) { withRule(input -> RegexUtil.matchesOr(input, regexs.toArray(new Pattern[regexs.size()])), exceptionCreator); return this; @@ -94,6 +95,23 @@ public class StringValidator extends PropertyValidator matchesAnd(Collection regexs, String errMsg) { + return matchesAnd(regexs, convertExceptionCreator(errMsg)); + } + + public StringValidator matchesAnd( + Collection regexs, + Supplier exceptionCreator) { + return matchesAnd(regexs, convertExceptionCreator(exceptionCreator)); + } + + public StringValidator matchesAnd( + Collection regexs, + Function exceptionCreator) { + withRule(input -> RegexUtil.matchesAnd(input, regexs.toArray(new Pattern[regexs.size()])), exceptionCreator); + return this; + } + // ===== notBlank ===== public StringValidator notBlank() {