Back to project page base-android-utils.
The source code is released under:
Apache License
If you think the Android project base-android-utils listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package me.pc.mobile.helper.v14.crypt; /*w ww. j av a2 s.c om*/ import java.lang.reflect.Array; import java.util.Collection; import java.util.Map; /** * ???? * * @company YeePay * @author xingwei.bi * @since 2010-9-9 * @version 1.0 */ public class CheckUtils { public static final String COMMON_FIELD = "flowID,initiator,"; /** * ??????????NULL,???????????Collection?Map(????????????????) * * @param obj * ??????? * @param message * ?????? */ @SuppressWarnings("rawtypes") public static void notEmpty(Object obj, String message) { if (obj == null) { throw new IllegalArgumentException(message + " must be specified"); } if (obj instanceof String && obj.toString().trim().length() == 0) { throw new IllegalArgumentException(message + " must be specified"); } if (obj.getClass().isArray() && Array.getLength(obj) == 0) { throw new IllegalArgumentException(message + " must be specified"); } if (obj instanceof Collection && ((Collection) obj).isEmpty()) { throw new IllegalArgumentException(message + " must be specified"); } if (obj instanceof Map && ((Map) obj).isEmpty()) { throw new IllegalArgumentException(message + " must be specified"); } } }