public final class Assert extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkArgument(boolean condition)
If the
condition is false, the method throws
IllegalArgumentException. |
static void |
checkArgument(boolean condition,
String errorMessage)
If the
condition is false, the method throws
IllegalArgumentException. |
static String |
checkNotBlank(String string,
String stringName)
Returns given string if it is not "blank" (i.e. it is not
null and does not contain just whitespace characters). |
static <T> T |
checkNotNull(T object)
Deprecated.
|
static <T> T |
checkNotNull(T object,
String objectName)
Deprecated.
|
static void |
checkState(boolean condition)
If the
condition is false, the method throws
IllegalStateException. |
static void |
checkState(boolean condition,
String errorMessage)
If the
condition is false, the method throws
IllegalStateException. |
@Deprecated public static <T> T checkNotNull(T object)
Objects.requireNonNull(Object)object is null, the method throws
IllegalArgumentException.T - type of the objectobject - object to checkIllegalArgumentException - if object is null@Deprecated public static <T> T checkNotNull(T object, String objectName)
Objects.requireNonNull(Object, String)object is null, the method throws
IllegalArgumentException.T - type of the objectobject - object to checkobjectName - object name passed to error messageIllegalArgumentException - if object is nullpublic static void checkArgument(boolean condition)
condition is false, the method throws
IllegalArgumentException.condition - condition to checkIllegalArgumentException - if condition is falsepublic static void checkArgument(boolean condition,
String errorMessage)
condition is false, the method throws
IllegalArgumentException.condition - condition to checkerrorMessage - error messageIllegalArgumentException - if condition is falsepublic static void checkState(boolean condition)
condition is false, the method throws
IllegalStateException.condition - condition to checkIllegalStateException - if condition is falsepublic static void checkState(boolean condition,
String errorMessage)
condition is false, the method throws
IllegalStateException.condition - condition to checkerrorMessage - error messageIllegalStateException - if condition is falsepublic static String checkNotBlank(String string, String stringName)
null and does not contain just whitespace characters).string - the string to check if it is not blankstringName - the name of the string variable that is checked (used for
displaying in a thrown exception)NullPointerException - (unchecked)
if the string argument is nullIllegalArgumentException - (unchecked)
if the string argument contains just whitespace
charactersCopyright © 2007-2018 Whitestein Technologies. All Rights Reserved.