public final class Assertions
extends java.lang.Object
Design by contract assertions.
This class is not part of the public API and may be removed or changed at any time.
Modifier | Constructor and Description |
---|---|
private |
Assertions() |
Modifier and Type | Method and Description |
---|---|
static void |
isTrue(java.lang.String name,
boolean condition)
Throw IllegalStateException if the condition if false.
|
static void |
isTrue(java.lang.String name,
boolean condition,
SingleResultCallback<?> callback)
Throw IllegalStateException if the condition if false.
|
static void |
isTrueArgument(java.lang.String name,
boolean condition)
Throw IllegalArgumentException if the condition if false.
|
static <T> T |
notNull(java.lang.String name,
T value)
Throw IllegalArgumentException if the value is null.
|
static <T> T |
notNull(java.lang.String name,
T value,
SingleResultCallback<?> callback)
Throw IllegalArgumentException if the value is null.
|
public static <T> T notNull(java.lang.String name, T value)
T
- the value typename
- the parameter namevalue
- the value that should not be nulljava.lang.IllegalArgumentException
- if value is nullpublic static <T> T notNull(java.lang.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 nulljava.lang.IllegalArgumentException
- if value is nullpublic static void isTrue(java.lang.String name, boolean condition)
name
- the name of the state that is being checkedcondition
- the condition about the parameter to checkjava.lang.IllegalStateException
- if the condition is falsepublic static void isTrue(java.lang.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 truejava.lang.IllegalStateException
- if the condition is falsepublic static void isTrueArgument(java.lang.String name, boolean condition)
name
- the name of the state that is being checkedcondition
- the condition about the parameter to checkjava.lang.IllegalArgumentException
- if the condition is false