| 1234567891011121314151617181920212223242526272829303132 |
- package com.ymwk.icvp.signature.utils;
- import java.lang.reflect.Array;
- import java.util.Collection;
- import java.util.Map;
- public class ObjectUtils {
-
- public static boolean isEmpty(Object obj) {
- if (obj == null) {
- return true;
- }
- if (obj instanceof CharSequence) {
- return ((CharSequence) obj).length() == 0;
- }
- if (obj.getClass().isArray()) {
- return Array.getLength(obj) == 0;
- }
- if (obj instanceof Collection) {
- return ((Collection) obj).isEmpty();
- }
- if (obj instanceof Map) {
- return ((Map) obj).isEmpty();
- }
- return false;
- }
- public static boolean isNotEmpty(Object obj) {
- return !isEmpty(obj);
- }
- }
|