public final class Assert extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
always(String message)
Will always throw and IlligalArgumentException
|
static void |
isFalse(boolean test,
String message)
Tests if condition is false
|
static <T> void |
isNull(T test,
String message)
Tests if object is null
|
static <T> void |
isNullOrEmpty(List<T> list,
String message)
Tests if list is null or empty
|
static <T,K> void |
isNullOrEmpty(Map<T,K> map,
String message)
Tests if map is null or empty
|
static <T> void |
isNullOrEmpty(Set<T> set,
String message)
Tests if set is null or empty
|
static <T> void |
isNullOrEmpty(T[] array,
String message)
Tests if array is null or empty
|
static void |
isTrue(boolean test,
String message)
Tests if condition is true
|
static <T> void |
notNull(T test,
String message)
Tests if object is !
|
static <T> void |
notNullOrEmpty(Collection<T> list,
String message)
Tests if list is null or empty
|
static <T,K> void |
notNullOrEmpty(Map<T,K> map,
String message)
Tests if map is null or empty
|
static <T> void |
notNullOrEmpty(Set<T> set,
String message)
Tests if list is null or empty
|
static <T> void |
notNullOrEmpty(T[] array,
String message)
Tests if list is null or empty
|
static void |
notNullOrEmptyTrimmed(String value,
String message)
Tests if String is null or empty when trimmed
|
public static void always(String message)
message - fail message aka: "forgot to implement this"public static void isFalse(boolean test,
String message)
test - must be falsemessage - to return in exceptionIllegalArgumentException - if test is truepublic static void isTrue(boolean test,
String message)
test - must be turemessage - to return in exceptionIllegalArgumentException - if test is falsepublic static <T> void isNull(T test,
String message)
T - object typetest - must be nullmessage - to return in exceptionIllegalArgumentException - if object != nullpublic static <T> void notNull(T test,
String message)
T - object typetest - must not be nullmessage - to return in exceptionIllegalArgumentException - if object == nullpublic static void notNullOrEmptyTrimmed(String value, String message)
value - must be non empty stringmessage - to return in exceptionIllegalArgumentException - if value == null, value == "" or
value.trim() == ""public static <T> void notNullOrEmpty(Collection<T> list, String message)
T - object typelist - must be have at least one elementmessage - to return in exceptionIllegalArgumentException - if list == null or list.size() == 0public static <T> void notNullOrEmpty(Set<T> set, String message)
T - object typeset - must be have at least one elementmessage - to return in exceptionIllegalArgumentException - if list == null or list.size() == 0public static <T> void notNullOrEmpty(T[] array,
String message)
T - object typearray - must be have at least one elementmessage - to return in exceptionIllegalArgumentException - if list == null or list.size() == 0public static <T,K> void notNullOrEmpty(Map<T,K> map, String message)
T - object typeK - value typemap - must be have at least one elementmessage - to return in exceptionIllegalArgumentException - if list == null or list.size() == 0public static <T> void isNullOrEmpty(List<T> list, String message)
T - object typelist - must be null or emptymessage - to return in exceptionIllegalArgumentException - if list != null or list.size() greater than
0public static <T> void isNullOrEmpty(Set<T> set, String message)
T - object typeset - must be null or emptymessage - to return in exceptionIllegalArgumentException - if list != null or list.size() greater than
0public static <T> void isNullOrEmpty(T[] array,
String message)
T - object typearray - must be null or emptymessage - to return in exceptionIllegalArgumentException - if list != null or list.size() greater than
0public static <T,K> void isNullOrEmpty(Map<T,K> map, String message)
T - object typeK - value typemap - must be null or emptymessage - to return in exceptionIllegalArgumentException - if list != null or list.size() greater than
0Copyright © 2016~2019–2019 dinstone. All rights reserved.