From 20549648c50148c9c8c658caf69dbd0c23f82a1f Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Sat, 29 Apr 2023 17:45:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20hasText=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xyz/zhouxy/plusone/commons/util/Assert.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java b/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java index fea90b6..b1abfac 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java @@ -206,6 +206,19 @@ public class Assert { Assert.isTrue(!Strings.isNullOrEmpty(str), errorMessageTemplate, args); } + // hasText - String + public static void hasText(@Nullable String str, Supplier e) throws E { + Assert.isTrue(MoreStrings.hasText(str), e); + } + + public static void hasText(@Nullable String str, String errorMessage) { + Assert.isTrue(MoreStrings.hasText(str), errorMessage); + } + + public static void hasText(@Nullable String str, String errorMessageTemplate, Object... args) { + Assert.isTrue(MoreStrings.hasText(str), errorMessageTemplate, args); + } + // private constructor private Assert() { throw new IllegalStateException("Utility class");