public final class Assertions extends Object
Design by contract assertions.
This class is not part of the public API and may be removed or changed at any time.
| Modifier and Type | Method and Description |
|---|---|
static void |
isTrue(String name,
boolean condition)
Throw IllegalStateException if the condition if false.
|
static void |
isTrue(String name,
boolean condition,
SingleResultCallback<?> callback)
Throw IllegalStateException if the condition if false.
|
static void |
isTrueArgument(String name,
boolean condition)
Throw IllegalArgumentException if the condition if false.
|
static <T> T |
notNull(String name,
T value)
Throw IllegalArgumentException if the value is null.
|
static <T> T |
notNull(String name,
T value,
SingleResultCallback<?> callback)
Throw IllegalArgumentException if the value is null.
|
public static <T> T notNull(String name, T value)
T - the value typename - the parameter namevalue - the value that should not be nullIllegalArgumentException - if value is nullpublic static <T> T notNull(String name, T value, SingleResultCallback<?> callback)
T - the value typename - the parameter namevalue - the value that should not be nullcallback - the callback that also is passed the exception if the value is nullIllegalArgumentException - if value is nullpublic static void isTrue(String name, boolean condition)
name - the name of the state that is being checkedcondition - the condition about the parameter to checkIllegalStateException - if the condition is falsepublic static void isTrue(String name, boolean condition, SingleResultCallback<?> callback)
name - the name of the state that is being checkedcondition - the condition about the parameter to checkcallback - the callback that also is passed the exception if the condition is not trueIllegalStateException - if the condition is falsepublic static void isTrueArgument(String name, boolean condition)
name - the name of the state that is being checkedcondition - the condition about the parameter to checkIllegalArgumentException - if the condition is false