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 a009e66..9a1a441 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java @@ -151,8 +151,46 @@ public class Assert { Assert.isTrue(MoreArrays.isEmpty(arr), errorMessageTemplate, args); } + // isEmpty - int[] + public static void isEmpty(@Nullable int[] arr, Supplier e) throws E { + Assert.isTrue(MoreArrays.isEmpty(arr), e); + } + + public static void isEmpty(@Nullable int[] arr, String errorMessage) { + Assert.isTrue(MoreArrays.isEmpty(arr), errorMessage); + } + + public static void isEmpty(@Nullable int[] arr, String errorMessageTemplate, Object... args) { + Assert.isTrue(MoreArrays.isEmpty(arr), errorMessageTemplate, args); + } + + // isEmpty - long[] + public static void isEmpty(@Nullable long[] arr, Supplier e) throws E { + Assert.isTrue(MoreArrays.isEmpty(arr), e); + } + + public static void isEmpty(@Nullable long[] arr, String errorMessage) { + Assert.isTrue(MoreArrays.isEmpty(arr), errorMessage); + } + + public static void isEmpty(@Nullable long[] arr, String errorMessageTemplate, Object... args) { + Assert.isTrue(MoreArrays.isEmpty(arr), errorMessageTemplate, args); + } + + // isEmpty - double[] + public static void isEmpty(@Nullable double[] arr, Supplier e) throws E { + Assert.isTrue(MoreArrays.isEmpty(arr), e); + } + + public static void isEmpty(@Nullable double[] arr, String errorMessage) { + Assert.isTrue(MoreArrays.isEmpty(arr), errorMessage); + } + + public static void isEmpty(@Nullable double[] arr, String errorMessageTemplate, Object... args) { + Assert.isTrue(MoreArrays.isEmpty(arr), errorMessageTemplate, args); + } + // isNotEmpty - Array - // TODO int[] long[] double[] public static void isNotEmpty(@Nullable T[] arr, Supplier e) throws E { Assert.isTrue(MoreArrays.isNotEmpty(arr), e); } @@ -165,6 +203,45 @@ public class Assert { Assert.isTrue(MoreArrays.isNotEmpty(arr), errorMessageTemplate, args); } + // isNotEmpty - int[] + public static void isNotEmpty(@Nullable int[] arr, Supplier e) throws E { + Assert.isTrue(MoreArrays.isNotEmpty(arr), e); + } + + public static void isNotEmpty(@Nullable int[] arr, String errorMessage) { + Assert.isTrue(MoreArrays.isNotEmpty(arr), errorMessage); + } + + public static void isNotEmpty(@Nullable int[] arr, String errorMessageTemplate, Object... args) { + Assert.isTrue(MoreArrays.isNotEmpty(arr), errorMessageTemplate, args); + } + + // isNotEmpty - long[] + public static void isNotEmpty(@Nullable long[] arr, Supplier e) throws E { + Assert.isTrue(MoreArrays.isNotEmpty(arr), e); + } + + public static void isNotEmpty(@Nullable long[] arr, String errorMessage) { + Assert.isTrue(MoreArrays.isNotEmpty(arr), errorMessage); + } + + public static void isNotEmpty(@Nullable long[] arr, String errorMessageTemplate, Object... args) { + Assert.isTrue(MoreArrays.isNotEmpty(arr), errorMessageTemplate, args); + } + + // isNotEmpty - double[] + public static void isNotEmpty(@Nullable double[] arr, Supplier e) throws E { + Assert.isTrue(MoreArrays.isNotEmpty(arr), e); + } + + public static void isNotEmpty(@Nullable double[] arr, String errorMessage) { + Assert.isTrue(MoreArrays.isNotEmpty(arr), errorMessage); + } + + public static void isNotEmpty(@Nullable double[] arr, String errorMessageTemplate, Object... args) { + Assert.isTrue(MoreArrays.isNotEmpty(arr), errorMessageTemplate, args); + } + // isEmpty - String public static void isEmpty(@Nullable String str, Supplier e) throws E { Assert.isTrue(Strings.isNullOrEmpty(str), e);