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