public final class PreconditionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
checkArgument(boolean expression)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArgument(boolean expression,
Object errorMessage)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkState(boolean expression)
Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
|
static void |
checkState(boolean expression,
Object errorMessage)
Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
|
public static void checkState(boolean expression)
expression
- a boolean expressionIllegalStateException
- if expression
is falsepublic static void checkState(boolean expression, @Nullable Object errorMessage)
expression
- a boolean expressionerrorMessage
- the exception message to use if the check fails; will be converted to a
string using String.valueOf(Object)
IllegalStateException
- if expression
is falsepublic static void checkArgument(boolean expression)
expression
- a boolean expressionIllegalArgumentException
- if expression
is falsepublic static void checkArgument(boolean expression, @Nullable Object errorMessage)
expression
- a boolean expressionerrorMessage
- the exception message to use if the check fails; will be converted to a
string using String.valueOf(Object)
IllegalArgumentException
- if expression
is falseCopyright © 2024 Global Biodiversity Information Facility (GBIF). All rights reserved.