public final class Assert
extends java.lang.Object
构造器和说明 |
---|
Assert() |
限定符和类型 | 方法和说明 |
---|---|
static void |
hasText(java.lang.String text,
java.lang.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(java.util.Collection<?> collection,
java.lang.String message)
Assert that the collection is not
null and not empty. |
static void |
notNull(java.lang.Object object,
java.lang.String message)
Assert that an object is not
null . |
public static void notEmpty(@Nullable java.util.Collection<?> collection, java.lang.String message)
null
and not empty.collection
- the collection to checkmessage
- the exception message to use if the assertion failsjava.lang.IllegalArgumentException
- if the collection is null
or emptypublic static void notNull(@Nullable java.lang.Object object, java.lang.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 failsjava.lang.IllegalArgumentException
- if the object is null
public static void hasText(@Nullable java.lang.String text, java.lang.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 failsjava.lang.IllegalArgumentException
- if the text does not contain valid text content