From 8be8be8f17ce2cd764cb50f1bf8cc5985ea13779 Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Sun, 1 Jun 2025 06:48:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20README=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 05cb77e..24f8a23 100644 --- a/README.md +++ b/README.md @@ -57,11 +57,12 @@ class CustomerMapValidator extends MapValidator { private static final CustomerMapValidator INSTANCE = new CustomerMapValidator(); - private static final String[] FIELD_NAMES = { + private static final String[] FIELD_NAMES = { "name", "emailAddress", "vipLevel", "customerId", "birthday", "address" }; private CustomerMapValidator() { + // validateAndCopy() 时默认保留的 key super(FIELD_NAMES); ruleForString("name").notBlank("姓名不能为空"); @@ -92,7 +93,7 @@ class CustomerMapValidator extends MapValidator { 使用: ```java public void foo(Map customer) { - CustomerMapValidator.getInstance().validate(customer); + Map validatedCustomer = CustomerMapValidator.getInstance().validateAndCopy(customer); // ... } ```