BeanUtils.copyProperties 的使用

1.对于list集合的使用:

ListUtils<UserVO> utils = BeanUtils.instantiate(ListUtils.class);
List<UserEntity> userList = userDAO.getUseByListID(params);
List<UserVO> userInfoList = Lists.newLinkedList();
BeanUtils.copyProperties(userList, userInfoList, UserVO.class);//这个不行

//这个可以

BeanCopierUtil.copyList(userList,UserVO.class);
2.对于对象的使用

UserEntity us = new UserEntity ();

UserVO uv = new UserVO();

BeanUtils.copyProperties(us, uv);

posted @ 2022-04-29 11:20  星空物语之韵  阅读(239)  评论(0)    收藏  举报