public final class AssertUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
isTrue(boolean expression,
@NonNull String message)
Validates that the argument condition is
true. |
static void |
notBlank(@Nullable String str,
@NonNull String message)
Validates that the specified string is neither
null, nor empty, nor blank (only
whitespace). |
static <T> void |
notEmpty(@Nullable Collection<T> collection,
@NonNull String message)
Validates that the specified argument collection is neither
null nor empty. |
static void |
notEmpty(@Nullable String str,
@NonNull String message)
Validates that the specified string is neither
null nor empty. |
static <T> void |
notEmpty(T[] array,
@NonNull String message)
Validates that the specified argument array is neither
null nor empty. |
static void |
notNull(@Nullable Object object,
@NonNull String message)
Validates that the specified argument is not
null. |
public static void isTrue(boolean expression,
@NonNull String message)
true.expression - The boolean expression to validate.message - The exception message to use if the assertion fails.IllegalArgumentException - If expression is false.public static void notBlank(@Nullable String str, @NonNull String message)
null, nor empty, nor blank (only
whitespace).str - The string to validate.message - The exception message to use if the assertion fails.NullPointerException - If the string is nullIllegalArgumentException - If the string is blank.public static <T> void notEmpty(@Nullable Collection<T> collection, @NonNull String message)
null nor empty.T - The type of the elements in the collection.collection - The collection to validate.message - The exception message to use if the assertion fails.NullPointerException - If the collection is null.IllegalArgumentException - If the collection is empty.public static <T> void notEmpty(T[] array,
@NonNull String message)
null nor empty.T - The type of the elements in the array.array - The array to validate.message - The exception message to use if the assertion fails.NullPointerException - If the array is nullIllegalArgumentException - If the array is empty.public static void notEmpty(@Nullable String str, @NonNull String message)
null nor empty.str - The string to validate.message - The exception message to use if the assertion fails.NullPointerException - If the string is nullIllegalArgumentException - If the string is empty.public static void notNull(@Nullable Object object, @NonNull String message)
null.object - The object to validate.message - The exception message to use if the assertion fails.NullPointerException - If the object is null.Copyright © 2016 - present; JODConverter.org. All rights reserved.