public final class Assertions
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
cast(java.lang.String name,
java.lang.Object value)
Cast an object to T.
|
static void |
isTrue(java.lang.String name,
boolean condition)
Throw IllegalStateException if the condition is false.
|
static <T> T |
notNull(java.lang.String name,
T value)
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 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 <T> T cast(java.lang.String name,
java.lang.Object value)
T - the type to cast toname - the parameter namevalue - the value to cast fromjava.lang.IllegalArgumentException - if the value is not