吴学文
2019-04-14 5f3da432874c19e17c7c5caaf044f714bbe851a3
java110-common/src/main/java/com/java110/common/util/Assert.java
@@ -38,6 +38,8 @@
    }
    /**
     * 判断 jsonObject 是否为空
     * @param jsonStr
@@ -81,11 +83,9 @@
     * @param jsonArray
     * @param message
     */
    public static void isNull(JSONArray jsonArray,String message){
    public static void listIsNull(List jsonArray,String message){
        Assert.isNull(jsonArray,message);
        if(jsonArray.size() < 1 ){
        if(jsonArray != null && jsonArray.size() > 0 ){
            throw new IllegalArgumentException(message) ;
        }
    }
@@ -95,9 +95,9 @@
     * @param targetList
     * @param message
     */
    public static void isNull(List<?> targetList , String message){
    public static void isNotNull(List<?> targetList , String message){
        Assert.isNull(targetList,message);
        Assert.notNull(targetList,message);
        if(targetList.size()< 1){
            throw new IllegalArgumentException(message) ;
@@ -129,6 +129,17 @@
            throw new IllegalArgumentException(message);
        }
    }
    /**
     * 判断 jsonObject 是否为空
     * @param strValue
     * @param message
     */
    public static void isJsonObject(String strValue,String message){
        if(!isJsonObject(strValue)){
            throw new IllegalArgumentException(message);
        }
    }
    /**
@@ -167,4 +178,12 @@
            throw new IllegalArgumentException(msg);
        }
    }
    public static void isDate(String text,String msg){
        try{
            DateUtil.getDefaultDateFromString(text);
        }catch (Exception e){
            throw new IllegalArgumentException(msg);
        }
    }
}