首页 新闻 会员 周边

JAVA:BeanUtil中setProperty与copyProperty有啥区别???

0
[已解决问题] 解决于 2016-08-21 00:51

如题。简简单单两句话就能问明白,为啥还得凑到20字。

泥猴桃\n的主页 泥猴桃\n | 菜鸟二级 | 园豆:202
提问于:2016-08-17 22:40
< >
分享
最佳答案
0

这个简单呢,对属性copy,或者设置值之类的,一般用于vo与model的转换...

奖励园豆:5
全力以赴001 | 小虾三级 |园豆:629 | 2016-08-18 16:19
其他回答(1)
0

这两个是完全不同的接口啊,功能不一样的:

public static void copyProperties(Object dest, Object orig) throws IllegalAccessException, InvocationTargetException

Copy property values from the origin bean to the destination bean for all cases where the property names are the same.

public static void setProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException

Set the specified property value, performing type conversions as required to conform to the type of the destination property.

小陆 | 园豆:365 (菜鸟二级) | 2016-08-18 11:14
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册