public class Contract extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends RuntimeException> |
check(boolean condition,
Class<T> exceptionType)
Checks the given contract condition.
|
static <T extends RuntimeException> |
check(boolean condition,
Class<T> exceptionType,
String message,
Object... arguments)
Checks the given contract condition.
|
static void |
checkArgument(boolean condition,
String message,
Object... arguments)
Checks the given contract condition of one or more input parameters of the calling method.
|
static void |
checkState(boolean condition,
String message,
Object... arguments)
Checks the given contract condition of the calling object's state.
|
public static <T extends RuntimeException> void check(boolean condition, Class<T> exceptionType)
IllegalArgumentException - if exceptionType is nullIllegalArgumentException - if exceptionType could not be instantiatedpublic static <T extends RuntimeException> void check(boolean condition, Class<T> exceptionType, String message, Object... arguments)
MessageFormat if any.IllegalArgumentException - if exceptionType is nullIllegalArgumentException - if exceptionType could not be instantiatedpublic static void checkArgument(boolean condition,
String message,
Object... arguments)
IllegalArgumentException with the given message if the check fails.
Interpolates the given arguments into the message using MessageFormat if any.public static void checkState(boolean condition,
String message,
Object... arguments)
IllegalStateException with the given message if the check fails.
Interpolates the given arguments into the message using MessageFormat if any.