public class PortablePreconditions extends Object
Modifier | Constructor and Description |
---|---|
protected |
PortablePreconditions()
Should not be instantiated
|
Modifier and Type | Method and Description |
---|---|
static void |
checkCondition(String name,
boolean condition)
Assert that this parameter is marked as valid by the condition passed as parameter.
|
static <T> void |
checkEachParameterNotNull(String name,
T... parameters)
Assert that this parameter is not null, as also each item of the array is not null.
|
static <T> void |
checkGreaterOrEqualTo(String name,
Comparable<T> parameter,
T nonNullValue)
Assert that this parameter is not null and greater or equal to the nonNullValue.
|
static <T> void |
checkGreaterThan(String name,
Comparable<T> parameter,
T nonNullValue)
Assert that this parameter is not null and greater than the nonNullValue.
|
static void |
checkNotEmpty(String name,
Map<?,?> parameter)
Assert that this parameter is not empty.
|
static String |
checkNotEmpty(String name,
String parameter)
Assert that this parameter is not empty.
|
static <T extends Collection<?>> |
checkNotEmpty(String name,
T parameter)
Assert that this parameter is not empty.
|
static <T> T[] |
checkNotEmpty(String name,
T[] parameter)
Assert that this parameter is not empty.
|
static <T> T |
checkNotNull(String name,
T parameter)
Assert that this parameter is not null.
|
static void |
checkNullMandatory(String name,
Object parameter)
Assert that this parameter is null.
|
protected PortablePreconditions()
public static void checkCondition(String name, boolean condition)
name
- of parametercondition
- itselfpublic static <T> void checkEachParameterNotNull(String name, T... parameters)
T
- parameter typename
- of parameterparameters
- itselfpublic static <T extends Collection<?>> T checkNotEmpty(String name, T parameter)
name
- of parameterparameter
- itselfpublic static void checkNotEmpty(String name, Map<?,?> parameter)
name
- of parameterparameter
- itselfpublic static String checkNotEmpty(String name, String parameter)
name
- of parameterparameter
- itselfpublic static <T> T[] checkNotEmpty(String name, T[] parameter)
T
- type of the arrayname
- of parameterparameter
- itselfpublic static <T> T checkNotNull(String name, T parameter)
name
- of parameterparameter
- itselfpublic static void checkNullMandatory(String name, Object parameter)
name
- of parameterparameter
- itselfpublic static <T> void checkGreaterThan(String name, Comparable<T> parameter, T nonNullValue)
name
- of the parameter.parameter
- the parameter value.nonNullValue
- a non null value for executing the comparison.public static <T> void checkGreaterOrEqualTo(String name, Comparable<T> parameter, T nonNullValue)
name
- of the parameter.parameter
- the parameter value.nonNullValue
- a non null value for executing the comparison.Copyright © 2017–2020 JBoss by Red Hat. All rights reserved.