public final class Check
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
condition(boolean c)
Check and ensure that a specific condition is met.
|
static void |
condition(boolean c,
java.lang.String message)
Check and ensure that a specific condition is met.
|
static <T> T |
fail()
Throw an exception to indicate that an unexpected execution state occurred.
|
static <T> T |
fail(java.lang.String message)
Throw an exception to indicate that an unexpected execution state occurred.
|
static <T> T |
nonNull(T o)
Check and ensure that an object is not
null. |
static <T> T |
nonNull(T o,
java.lang.String message)
Check and ensure that an object is not
null. |
public static <T> T nonNull(@Nullable T o) throws java.lang.NullPointerException
null.T - The actual object type.o - The object to check.null).java.lang.NullPointerException - if the submitted argument is null.public static <T> T nonNull(@Nullable T o, java.lang.String message) throws java.lang.NullPointerException
null.T - The actual object type.o - The object to check.message - The message to issue if the check fails.null).java.lang.NullPointerException - if the submitted argument is null.public static void condition(boolean c)
throws java.lang.IllegalStateException
c - The condition to check.java.lang.IllegalStateException - if the condition is not met.public static void condition(boolean c,
java.lang.String message)
throws java.lang.IllegalStateException
c - The condition to check.message - The message to issue if the check fails.java.lang.IllegalStateException - if the condition is not met.public static <T> T fail()
throws java.lang.IllegalStateException
T - The generic return type.java.lang.IllegalStateException - any time this function is called.public static <T> T fail(java.lang.String message)
throws java.lang.IllegalStateException
T - The generic return type.message - The message to issue if the check fails.java.lang.IllegalStateException - any time this function is called.