public final class Validator extends Object
更多说明,参见 wiki Validator wiki
isNullOrEmpty(Object) 判断对象是否是null或者emptyisNotNullOrEmpty(Object) 判断对象是否不是null或者不是emptyString.trim(),
Map.isEmpty(),
Collection.isEmpty(),
Enumeration.hasMoreElements(),
Iterator.hasNext(),
Validate,
StringUtils.isBlank(CharSequence),
StringUtils.isEmpty(CharSequence),
ArrayUtils.isEmpty(byte[]),
ArrayUtils.isEmpty(boolean[]),
ArrayUtils.isEmpty(char[]),
ArrayUtils.isEmpty(int[]),
ArrayUtils.isEmpty(long[]),
ArrayUtils.isEmpty(short[]),
ArrayUtils.isEmpty(float[]),
ArrayUtils.isEmpty(double[]),
ArrayUtils.isEmpty(Object[]),
CollectionUtils.sizeIsEmpty(Object),
CollectionUtils.isEmpty(Collection),
CollectionUtils.isNotEmpty(Collection),
MapUtils.isEmpty(Map),
MapUtils.isNotEmpty(Map)| Modifier and Type | Method and Description |
|---|---|
static boolean |
isNotNullOrEmpty(Object value)
判断对象
value 是否不是null或者empty,调用 !isNullOrEmpty(Object) 方法 . |
static boolean |
isNullOrEmpty(Object value)
判断对象
value 是不是 null或者empty. |
public static boolean isNullOrEmpty(Object value)
value 是不是 null或者empty.
// null Validator.isNullOrEmpty(null) = true //CharSequence Validator.isNullOrEmpty("") = true Validator.isNullOrEmpty(" ") = true Validator.isNullOrEmpty(new StringBuffer()) = true Validator.isNullOrEmpty(new StringBuffer("")) = true Validator.isNullOrEmpty(new StringBuffer(" ")) = true Validator.isNullOrEmpty(new StringBuilder()) = true Validator.isNullOrEmpty(new StringBuilder("")) = true Validator.isNullOrEmpty(new StringBuilder(" ")) = true //Collection Validator.isNullOrEmpty(new ArrayList<String>()) = true //Map Validator.isNullOrEmpty(new LinkedHashMap<String, String>()) = true //Iterator Validator.isNullOrEmpty(new ArrayList<String>().iterator()) = true //Enumeration Validator.isNullOrEmpty(toEnumeration(new ArrayList<String>())) = true //Array Validator.isNullOrEmpty(new String[] {}) = true Validator.isNullOrEmpty(new Integer[][] {}) = true Validator.isNullOrEmpty(new User[] {}) = true //Primitive Array Validator.isNullOrEmpty(new double[] {}) = true Validator.isNullOrEmpty(new float[] {}) = true Validator.isNullOrEmpty(new long[] {}) = true Validator.isNullOrEmpty(new int[] {}) = true Validator.isNullOrEmpty(new short[] {}) = true Validator.isNullOrEmpty(new char[] {}) = true Validator.isNullOrEmpty(new byte[] {}) = true Validator.isNullOrEmpty(new boolean[] {}) = true
value - 可以是Collection,Map,Enumeration,Iterator,Iterable,CharSequence,
以及所有数组类型(包括原始类型数组)CollectionUtils.sizeIsEmpty(Object),
StringUtils.isBlank(CharSequence)public static boolean isNotNullOrEmpty(Object value)
value 是否不是null或者empty,调用 !isNullOrEmpty(Object) 方法 .
示例参考 isNullOrEmpty(Object) 方法
value - 可以是Collection,Map,Enumeration,Iterator,Iterable,CharSequence
,以及所有数组类型(包括原始类型数组)isNullOrEmpty(Object)Copyright © 2008-2019 by feilong