public class ArgumentUtils extends 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(String name,
T value)
Perform a check on an argument.
|
static <T> T |
requireNonNull(String name,
T value)
Adds a check that the given number is positive.
|
static int |
requirePositive(String name,
int value)
Adds a check that the given number is positive.
|
static Number |
requirePositive(String name,
Number value)
Adds a check that the given number is positive.
|
@Nonnull public static Number requirePositive(String name, Number value)
name
- The name of the argumentvalue
- The valueIllegalArgumentException
- if the argument is not positivepublic static <T> T requireNonNull(String name, T value)
T
- The generic typename
- The name of the argumentvalue
- The valueIllegalArgumentException
- if the argument is not positivepublic static int requirePositive(String name, int value)
name
- The name of the argumentvalue
- The valueIllegalArgumentException
- if the argument is not positivepublic static ArgumentUtils.ArgumentCheck check(ArgumentUtils.Check check)
check
- The checkArgumentUtils.ArgumentCheck
public static <T> ArgumentUtils.ArgumentCheck check(String name, T value)
T
- The value typename
- The name of the argumentvalue
- The value of the argumentArgumentUtils.ArgumentCheck