diff --git a/src/main/java/xyz/zhouxy/plusone/validator/StringValidator.java b/src/main/java/xyz/zhouxy/plusone/validator/StringValidator.java index 8494fd9..f1676b0 100644 --- a/src/main/java/xyz/zhouxy/plusone/validator/StringValidator.java +++ b/src/main/java/xyz/zhouxy/plusone/validator/StringValidator.java @@ -162,7 +162,7 @@ public class StringValidator extends PropertyValidator StringValidator notEmpty( Function exceptionCreator) { - withRule(value -> (value != null) && (!value.isEmpty()), exceptionCreator); + withRule(StringUtils::isNotEmpty, exceptionCreator); return this; } @@ -178,7 +178,7 @@ public class StringValidator extends PropertyValidator StringValidator isEmpty( Function exceptionCreator) { - withRule(value -> value == null || value.isEmpty(), exceptionCreator); + withRule(StringUtils::isEmpty, exceptionCreator); return this; }