public final class Assert extends Object
| Constructor and Description |
|---|
Assert() |
| Modifier and Type | Method and Description |
|---|---|
static void |
hasText(String text,
String message)
Assert that the given String contains valid text content; that is, it must not be
null and must contain at least one non-whitespace character. |
static void |
notEmpty(Collection<?> collection,
String message)
Assert that the collection is not
null and not empty. |
static void |
notNull(Object object,
String message)
Assert that an object is not
null. |
public static void notEmpty(@Nullable
Collection<?> collection,
String message)
null and not empty.collection - the collection to checkmessage - the exception message to use if the assertion failsIllegalArgumentException - if the collection is null or emptypublic static void notNull(@Nullable
Object object,
String message)
null.
Assert.notNull(clazz, "The class must not be null");
object - the object to checkmessage - the exception message to use if the assertion failsIllegalArgumentException - if the object is nullpublic static void hasText(@Nullable
String text,
String message)
null and must contain at least one non-whitespace character.
Assert.hasText(name, "'name' must not be empty");
text - the String to checkmessage - the exception message to use if the assertion failsIllegalArgumentException - if the text does not contain valid text contentCopyright © 2025. All rights reserved.