public final class Check
extends java.lang.Object
| Modifier and Type | Method | Description |
|---|---|---|
static <T> T |
optional(T value,
java.lang.String parameterName,
Verify<? super T>... verifiers) |
Perform checks on an optional value.
|
static <T> T |
required(T value,
java.lang.String parameterName,
Verify<? super T>... verifiers) |
Perform checks on a required value (must not be null).
|
@SafeVarargs
public static <T> T optional(T value,
java.lang.String parameterName,
Verify<? super T>... verifiers)
IllegalArgumentException will be thrown, including the parameter name an
error message.T - value typevalue - value to be checkedparameterName - parameter name of the value (will be included in the error message)verifiers - optional verifiers which perform checks on the value (only called when the value is not
null), and throw any Exception (will be converted to an IllegalArgumentException
is the same message) when the validation fails.@SafeVarargs
public static <T> T required(T value,
java.lang.String parameterName,
Verify<? super T>... verifiers)
IllegalArgumentException will be thrown, including the parameter name an
error message.T - value typevalue - value to be checkedparameterName - parameter name of the value (will be included in the error message)verifiers - optional verifiers which perform checks on the value (only called when the value is not
null), and throw any Exception (will be converted to an IllegalArgumentException
is the same message) when the validation fails.