引用包里面的工具类

来源:互联网 发布:热门的数据库研究方向 编辑:程序博客网 时间:2024/06/05 09:44
1、BeanUtils.copyProperties()
BeanUtils类在org.springframework.beans.BeanUtils和org.apache.commons.beanutils.BeanUtils都存在,但这两个类的copyProperties()方法里面传递的参数赋值是相反的。
例如:a,b为对象,使用BeanUtils.copyProperties(a, b)时作用不一样
org.springframework.beans.BeanUtils表示:a拷贝到b;org.apache.commons.beanutils.BeanUtils表示:b拷贝到a;

if(a != null){BeanUtils.copyProperties(a, bcopya);bcopya.setPa(true);bcopya.setPb("888");}


2、org.apache.commons.lang3.StringUtils
if (StringUtils.isAnyBlank(pa,pb)) {    return prompt.show("自定义提示语");}


3、org.apache.commons.collections.CollectionUtils
//null或者空if(CollectionUtils.isNotEmpty(sourceList)){}
0 0
原创粉丝点击