public class ArgumentUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ArgumentUtils.ArgumentCheck<T>
Allows producing error messages.
|
static interface |
ArgumentUtils.Check
Functional interface the check a condition.
|
| Constructor and Description |
|---|
ArgumentUtils() |
| Modifier and Type | Method and Description |
|---|---|
static ArgumentUtils.ArgumentCheck |
check(ArgumentUtils.Check check)
Perform a check on an argument.
|
static <T> ArgumentUtils.ArgumentCheck |
check(java.lang.String name,
T value)
Perform a check on an argument.
|
static <T> T |
requireNonNull(java.lang.String name,
T value)
Adds a check that the given number is not null.
|
static int |
requirePositive(java.lang.String name,
int value)
Adds a check that the given number is positive.
|
static java.lang.Number |
requirePositive(java.lang.String name,
java.lang.Number value)
Adds a check that the given number is positive.
|
@NonNull
public static java.lang.Number requirePositive(java.lang.String name,
java.lang.Number value)
name - The name of the argumentvalue - The valuejava.lang.IllegalArgumentException - if the argument is not positivepublic static <T> T requireNonNull(java.lang.String name,
T value)
T - The generic typename - The name of the argumentvalue - The valuejava.lang.NullPointerException - if the argument is nullpublic static int requirePositive(java.lang.String name,
int value)
name - The name of the argumentvalue - The valuejava.lang.IllegalArgumentException - if the argument is not positivepublic static ArgumentUtils.ArgumentCheck check(ArgumentUtils.Check check)
check - The checkArgumentUtils.ArgumentCheckpublic static <T> ArgumentUtils.ArgumentCheck check(java.lang.String name, T value)
T - The value typename - The name of the argumentvalue - The value of the argumentArgumentUtils.ArgumentCheck