public final class Requirements extends Object
This convenience class constructs a RequirementVerifier or AssertionVerifier with
a default configuration. The class's assertion status determines whether
AssertionVerifier is enabled or not.
| Modifier and Type | Method and Description |
|---|---|
static boolean |
assertionsAreEnabled() |
static BigDecimalRequirements |
assertThat(BigDecimal parameter,
String name)
Same as
requireThat(BigDecimal, String) but does nothing if assertions are disabled
for this class. |
static <T> ClassRequirements<T> |
assertThat(Class<T> parameter,
String name)
Same as
requireThat(Class, String) but does nothing if assertions are disabled for
this class. |
static <E> CollectionRequirements<E> |
assertThat(Collection<E> parameter,
String name)
Same as
requireThat(Collection, String) but does nothing if assertions are disabled
for this class. |
static DoubleRequirements |
assertThat(Double parameter,
String name)
Same as
requireThat(Double, String) but does nothing if assertions are disabled for
this class. |
static <K,V> MapRequirements<K,V> |
assertThat(Map<K,V> parameter,
String name)
Same as
requireThat(Map, String) but does nothing if assertions are disabled for this
class. |
static ObjectRequirements<Object> |
assertThat(Object parameter,
String name)
Same as
requireThat(Object, String) but does nothing if assertions are disabled for
this class. |
static OptionalRequirements |
assertThat(Optional<?> parameter,
String name)
Same as
requireThat(Optional, String) but does nothing if assertions are disabled for
this class. |
static PathRequirements |
assertThat(Path parameter,
String name)
Same as
requireThat(Path, String) but does nothing if assertions are disabled for this
class. |
static StringRequirements |
assertThat(String parameter,
String name)
Same as
requireThat(String, String) but does nothing if assertions are disabled for
this class. |
static <T extends Comparable<? super T>> |
assertThat(T parameter,
String name)
Same as
requireThat(Comparable, String) but does nothing if assertions are disabled
for this class. |
static <T extends Number & Comparable<? super T>> |
assertThat(T parameter,
String name)
Same as
requireThat(Number, String) but does nothing if assertions are disabled for
this class. |
static UriRequirements |
assertThat(URI parameter,
String name)
Same as
requireThat(URI, String) but does nothing if assertions are disabled for this
class. |
static BigDecimalRequirements |
requireThat(BigDecimal parameter,
String name)
Verifies requirements of a
BigDecimal. |
static <T> ClassRequirements<T> |
requireThat(Class<T> parameter,
String name)
Verifies requirements of a
Class. |
static <E> CollectionRequirements<E> |
requireThat(Collection<E> parameter,
String name)
Verifies requirements of a
Collection. |
static DoubleRequirements |
requireThat(Double parameter,
String name)
Verifies requirements of a
Double. |
static <K,V> MapRequirements<K,V> |
requireThat(Map<K,V> parameter,
String name)
Verifies requirements of a
Map. |
static ObjectRequirements<Object> |
requireThat(Object parameter,
String name)
Verifies requirements of an
Object. |
static OptionalRequirements |
requireThat(Optional<?> parameter,
String name)
Verifies requirements of an
Optional. |
static PathRequirements |
requireThat(Path parameter,
String name)
Verifies requirements of a
Path. |
static StringRequirements |
requireThat(String parameter,
String name)
Verifies requirements of a
String. |
static <T extends Comparable<? super T>> |
requireThat(T parameter,
String name)
Verifies requirements of a
Comparable. |
static <T extends Number & Comparable<? super T>> |
requireThat(T parameter,
String name)
Verifies requirements of a
Number. |
static UriRequirements |
requireThat(URI parameter,
String name)
Verifies requirements of a
Uri. |
@Beta public static boolean assertionsAreEnabled()
public static ObjectRequirements<Object> requireThat(Object parameter, String name) throws NullPointerException, IllegalArgumentException
Object.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static ObjectRequirements<Object> assertThat(Object parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Object, String) but does nothing if assertions are disabled for
this class.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <E> CollectionRequirements<E> requireThat(Collection<E> parameter, String name) throws NullPointerException, IllegalArgumentException
Collection.E - the type of element in the collectionparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <E> CollectionRequirements<E> assertThat(Collection<E> parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Collection, String) but does nothing if assertions are disabled
for this class.E - the type of element in the collectionparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <T extends Comparable<? super T>> ComparableRequirements<T> requireThat(T parameter, String name) throws NullPointerException, IllegalArgumentException
Comparable.T - the type of objects that the parameter may be compared toparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <T extends Comparable<? super T>> ComparableRequirements<T> assertThat(T parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Comparable, String) but does nothing if assertions are disabled
for this class.T - the type of objects that the parameter may be compared toparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <T extends Number & Comparable<? super T>> NumberRequirements<T> requireThat(T parameter, String name) throws NullPointerException, IllegalArgumentException
Number.T - the type of the numberparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <T extends Number & Comparable<? super T>> NumberRequirements<T> assertThat(T parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Number, String) but does nothing if assertions are disabled for
this class.T - the type of the numberparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static DoubleRequirements requireThat(Double parameter, String name) throws NullPointerException, IllegalArgumentException
Double.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static DoubleRequirements assertThat(Double parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Double, String) but does nothing if assertions are disabled for
this class.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static BigDecimalRequirements requireThat(BigDecimal parameter, String name) throws NullPointerException, IllegalArgumentException
BigDecimal.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static BigDecimalRequirements assertThat(BigDecimal parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(BigDecimal, String) but does nothing if assertions are disabled
for this class.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <K,V> MapRequirements<K,V> requireThat(Map<K,V> parameter, String name) throws NullPointerException, IllegalArgumentException
Map.K - the type of key in the mapV - the type of value in the mapparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <K,V> MapRequirements<K,V> assertThat(Map<K,V> parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Map, String) but does nothing if assertions are disabled for this
class.K - the type of key in the mapV - the type of value in the mapparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static PathRequirements requireThat(Path parameter, String name) throws NullPointerException, IllegalArgumentException
Path.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static PathRequirements assertThat(Path parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Path, String) but does nothing if assertions are disabled for this
class.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static StringRequirements requireThat(String parameter, String name) throws NullPointerException, IllegalArgumentException
String.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static StringRequirements assertThat(String parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(String, String) but does nothing if assertions are disabled for
this class.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static UriRequirements requireThat(URI parameter, String name) throws NullPointerException, IllegalArgumentException
Uri.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static UriRequirements assertThat(URI parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(URI, String) but does nothing if assertions are disabled for this
class.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <T> ClassRequirements<T> requireThat(Class<T> parameter, String name) throws NullPointerException, IllegalArgumentException
Class.T - the type of classparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static <T> ClassRequirements<T> assertThat(Class<T> parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Class, String) but does nothing if assertions are disabled for
this class.T - the type of classparameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static OptionalRequirements requireThat(Optional<?> parameter, String name) throws NullPointerException, IllegalArgumentException
Optional.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptypublic static OptionalRequirements assertThat(Optional<?> parameter, String name) throws NullPointerException, IllegalArgumentException
requireThat(Optional, String) but does nothing if assertions are disabled for
this class.parameter - the value of the parametername - the name of the parameterNullPointerException - if name is nullIllegalArgumentException - if name is emptyCopyright © 2016. All rights reserved.