public final class Checks extends Object
Constructor and Description |
---|
Checks() |
Modifier and Type | Method and Description |
---|---|
static void |
checkArgument(boolean condition,
String message)
Checks that an argument satisfies requirement.
|
static void |
checkArgument(boolean condition,
String message,
Object... args)
Checks that an argument satisfies requirement.
|
static int |
checkMax(int max)
Checks that
max isn't negative. |
static int |
checkMin(int min)
Checks that
min isn't negative. |
static void |
checkMinMax(int min,
int max)
Checks that neither
min or max is negative and min <= max . |
static int |
checkNonNegative(int n,
String message)
Checks that
n isn't negative. |
static <T> T |
checkNotNull(T value)
Checks that
value cannot be null. |
static void |
checkNotNullState(Object object,
String message)
Checks that
object is not null. |
static void |
checkNotNullState(Object object,
String message,
Object... args)
Checks that
object is not null. |
static void |
checkState(boolean condition,
String message)
Checks a certain state.
|
static void |
checkState(boolean condition,
String message,
Object... args)
Checks a certain state.
|
public static <T> T checkNotNull(T value) throws NullPointerException
value
cannot be null.NullPointerException
public static void checkArgument(boolean condition, String message) throws IllegalArgumentException
condition
- the condition that has to be truemessage
- the error message if condition
is falseargs
- the arguments to the error messageIllegalArgumentException
- if condition
is falsepublic static void checkArgument(boolean condition, String message, Object... args) throws IllegalArgumentException
condition
- the condition that has to be truemessage
- the error message if condition
is falseargs
- the arguments to the error messageIllegalArgumentException
- if condition
is falsepublic static void checkState(boolean condition, String message) throws IllegalStateException
condition
- the condition of the state that has to be truemessage
- the error message if condition
is falseargs
- the arguments to the error messageIllegalStateException
- if condition
is falsepublic static void checkState(boolean condition, String message, Object... args) throws IllegalStateException
condition
- the condition of the state that has to be truemessage
- the error message if condition
is falseargs
- the arguments to the error messageIllegalStateException
- if condition
is falsepublic static void checkNotNullState(Object object, String message)
object
is not null.object
- the object that cannot be nullmessage
- the error message if condition
is falseargs
- the arguments to the error messageIllegalStateException
- if object
is nullpublic static void checkNotNullState(Object object, String message, Object... args)
object
is not null.object
- the object that cannot be nullmessage
- the error message if condition
is falseargs
- the arguments to the error messageIllegalStateException
- if object
is nullpublic static void checkMinMax(int min, int max)
min
or max
is negative and min <= max
.public static int checkMin(int min)
min
isn't negative.public static int checkMax(int max)
max
isn't negative.public static int checkNonNegative(int n, String message)
Copyright © 2013–2016 jparsec. All rights reserved.