public final class Assert
extends java.lang.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,
java.lang.String errorMessage)
If the
condition is false, the method throws
IllegalArgumentException . |
static java.lang.String |
checkNotBlank(java.lang.String string,
java.lang.String stringName)
Returns given string if it is not "blank" (i.e. it is not
null and does not contain just whitespace characters). |
static void |
checkState(boolean condition)
If the
condition is false, the method throws
IllegalStateException . |
static void |
checkState(boolean condition,
java.lang.String errorMessage)
If the
condition is false, the method throws
IllegalStateException . |
public static void checkArgument(boolean condition)
condition
is false, the method throws
IllegalArgumentException
.condition
- condition to checkjava.lang.IllegalArgumentException
- if condition
is falsepublic static void checkArgument(boolean condition, java.lang.String errorMessage)
condition
is false, the method throws
IllegalArgumentException
.condition
- condition to checkerrorMessage
- error messagejava.lang.IllegalArgumentException
- if condition
is falsepublic static void checkState(boolean condition)
condition
is false, the method throws
IllegalStateException
.condition
- condition to checkjava.lang.IllegalStateException
- if condition
is falsepublic static void checkState(boolean condition, java.lang.String errorMessage)
condition
is false, the method throws
IllegalStateException
.condition
- condition to checkerrorMessage
- error messagejava.lang.IllegalStateException
- if condition
is falsepublic static java.lang.String checkNotBlank(java.lang.String string, java.lang.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)java.lang.NullPointerException
- (unchecked)
if the string
argument is null
java.lang.IllegalArgumentException
- (unchecked)
if the string
argument contains just whitespace
charactersCopyright © 2007-2020 Whitestein Technologies. All Rights Reserved.