From ae970cb393bc6ec2b4f7ddbdf45cddb361b47adf Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Tue, 27 May 2025 23:53:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E8=BD=BD=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `BasePropertyValidator#notNull`、`CollectionPropertyValidator#notEmpty` 和 `CollectionPropertyValidator#isEmpty` 提供无参的版本 --- .../plusone/validator/BasePropertyValidator.java | 4 ++++ .../validator/CollectionPropertyValidator.java | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/plusone-validator/src/main/java/xyz/zhouxy/plusone/validator/BasePropertyValidator.java b/plusone-validator/src/main/java/xyz/zhouxy/plusone/validator/BasePropertyValidator.java index d3255b5..8350810 100644 --- a/plusone-validator/src/main/java/xyz/zhouxy/plusone/validator/BasePropertyValidator.java +++ b/plusone-validator/src/main/java/xyz/zhouxy/plusone/validator/BasePropertyValidator.java @@ -100,6 +100,10 @@ public abstract class BasePropertyValidator // ====== notEmpty ===== + public CollectionPropertyValidator notEmpty() { + return notEmpty("The input must not be empty."); + } + public CollectionPropertyValidator notEmpty(String errMsg) { return notEmpty(convertExceptionCreator(errMsg)); } - public CollectionPropertyValidator notEmpty(Supplier exceptionCreator) { + public CollectionPropertyValidator notEmpty( + Supplier exceptionCreator) { return notEmpty(convertExceptionCreator(exceptionCreator)); } @@ -47,11 +52,16 @@ public class CollectionPropertyValidator // ====== isEmpty ===== + public CollectionPropertyValidator isEmpty() { + return isEmpty("The input must be empty."); + } + public CollectionPropertyValidator isEmpty(String errMsg) { return isEmpty(convertExceptionCreator(errMsg)); } - public CollectionPropertyValidator isEmpty(Supplier exceptionCreator) { + public CollectionPropertyValidator isEmpty( + Supplier exceptionCreator) { return isEmpty(convertExceptionCreator(exceptionCreator)); }