雪洗中关村

导航

Assert随笔

☆   Assert.notNull(haha, "未找到需要导入的计划1");//haha必须不能为null,if为null则抛出message的异常;
    Assert.hasText((message, "输入信息错误!"); <==> if (message== null || message.equls("")) {   throw new IllegalArgumentException("输入信息错误!");  }  
    Assert.notNull(Object object, "object is required")                                -    对象非空 
    Assert.hasText(String text, "text must not be empty")                              -    text 不为null且必须至少包含一个非空格的字符 
    Assert.notEmpty(Collection collection, "collection must not be empty")             -    集合map非空 
    Assert.isTrue(Object object, "object must be true")                                -    对象必须为true   
    Assert.hasLength(String text, "text must be specified")                            -    字符不为null且字符长度不为0   
    Assert.isInstanceOf(Class clazz, Object obj, "clazz must be of type [clazz]")      -    obj必须能被正确造型成为clazz 指定的类
    

 

posted on 2018-05-16 08:58  雪洗中关村  阅读(129)  评论(0编辑  收藏  举报