public final class Check extends Object
| Constructor and Description |
|---|
Check() |
| Modifier and Type | Method and Description |
|---|---|
static void |
argument(boolean expression)
Ensures the truth of an expression involving one or more parameters to
the calling method.
|
static void |
argument(boolean expression,
Object errorMessage)
Ensures the truth of an expression involving one or more parameters to
the calling method.
|
static <T> T |
notNull(T reference)
Check that
reference is not null. |
static <T> T |
notNull(T reference,
Object errorMessage)
Check that
reference is not null. |
public static <T> T notNull(T reference)
reference is not null. If it is, throw a
NullPointerException.reference - reference to check is null or notreference so it may be usedNullPointerException - if reference is nullpublic static <T> T notNull(T reference,
Object errorMessage)
reference is not null. If it is, throw a
NullPointerException.reference - reference to check is null or noterrorMessage - message passed to the NullPointerException constructor
to give more context when debuggingreference so it may be usedNullPointerException - if reference is nullpublic static void argument(boolean expression)
expression - a boolean expressionIllegalArgumentException - if expression is falsepublic static void argument(boolean expression,
Object errorMessage)
expression - a boolean expressionerrorMessage - the exception message to use if the check fails; will be
converted to a string using String.valueOf(Object)IllegalArgumentException - if expression is falseCopyright © 2015 Atlassian. All rights reserved.