public class ParameterValidation extends Object
IllegalArgumentException is the validation fails.| Modifier and Type | Field and Description |
|---|---|
static String |
MAPPER_RETURNED_NULL |
static String |
SUPPLIER_PRODUCED_NULL |
| Modifier and Type | Method and Description |
|---|---|
static <T> T[] |
doesNotContainNull(T[] array,
String name)
Ensures that the given array does not contain a
null value. |
static <T extends Iterable<?>> |
doesNotContainNull(T iterable,
String name)
Ensures that the given iterable does not contain a
null value. |
static <T> T |
nonNull(T instance,
String name)
Validates that the given
instance is not null |
static <T> T |
nonNullNpe(T instance,
String name) |
static int |
positive(int amount,
String name)
Validates that the passed amount is strictly positive.
|
static long |
positive(long amount,
String name)
Validates that the passed amount is strictly positive.
|
static int |
positiveOrZero(int amount,
String name)
Validates that the passed amount is positive (including 0).
|
static long |
positiveOrZero(long amount,
String name)
Validates that the passed amount is positive (including 0).
|
static <T extends Collection<?>> |
size(T instance,
int expectedSize,
String name)
Validates that the given collection
instance has size matching the expectedSize |
static Duration |
validate(Duration duration,
String name)
Validates that the passed duration is not
null and strictly positive. |
public static final String SUPPLIER_PRODUCED_NULL
public static final String MAPPER_RETURNED_NULL
public static Duration validate(Duration duration, String name)
null and strictly positive.duration - the durationname - the name of the parameter, must not be nullpublic static <T> T nonNull(T instance,
String name)
instance is not nullT - the type of the instanceinstance - the instancename - the name of the parameter, must not be nullpublic static <T> T nonNullNpe(T instance,
String name)
public static long positive(long amount,
String name)
amount - the amount to be checkedname - the name of the parameter, must not be nullpublic static int positive(int amount,
String name)
amount - the amount to be checkedname - the name of the parameter, must not be nullpublic static int positiveOrZero(int amount,
String name)
amount - the amount to be checkedname - the name of the parameter, must not be nullpublic static long positiveOrZero(long amount,
String name)
amount - the amount to be checkedname - the name of the parameter, must not be nullpublic static <T extends Iterable<?>> T doesNotContainNull(T iterable, String name)
null value.T - the type of the instanceiterable - the iterablename - the name of the parameter, must not be nullpublic static <T> T[] doesNotContainNull(T[] array,
String name)
null value.T - the type of the item contained in the arrayarray - the arrayname - the name of the parameter, must not be nullpublic static <T extends Collection<?>> T size(T instance, int expectedSize, String name)
instance has size matching the expectedSizeT - the type of the instanceinstance - the instanceexpectedSize - the expected sizename - the name of the parameter, must not be nullCopyright © 2019–2020 SmallRye. All rights reserved.