blog.TangGaowei.com

PropertyUtils.copyProperties 允许对象属性为 null

作者 Neot 写于 2009-01-14  | 2,192 次浏览 | 分类 » 软件开发 |

BeanUtils.copyProperties 与 PropertyUtils.copyProperties 都是拷贝对象属性的方法,BeanUtils 支持类型转换,而 PropertyUtils 不支持。但是 BeanUtils 不允许对象的属性值为 null,PropertyUtils 可以拷贝属性值 null 的对象。

如果对象属性值为 null,BeanUtils.copyProperties 方法会报 commons.beanutils.ConversionException: No value specified 错误。

[ 标签: PropertyUtils ]
[ 固定链接:http://blog.tanggaowei.com/2009/01/propertyutilscopyproperties-null.html ]
  • 暂无相关日志

发表评论


点击图片可以听验证码

订阅

 

手机访问

http://blog.tanggaowei.com/wap/

Google