/**
* 扩展org.apache.commons.beanutils.BeanUtils
* @author jerry
*
*/
public class MyBeanUtils extends BeanUtils{
/**
* 解决Date bigdecimal为空时不能复制的问题
* liuy-af
* 2016-3-15
*/
static {
ConvertUtils.register(new org.apache.commons.beanutils.converters.BigDecimalConverter(null), BigDecimal.class);
ConvertUtils.register(new org.apache.commons.beanutils.converters.DateConverter(null), java.util.Date.class);
ConvertUtils.register(new org.apache.commons.beanutils.converters.SqlTimestampConverter(null), java.sql.Timestamp.class);
ConvertUtils.register(new org.apache.commons.beanutils.converters.SqlDateConverter(null), java.sql.Date.class);
ConvertUtils.register(new org.apache.commons.beanutils.converters.SqlTimeConverter(null), java.sql.Time.class);
}
/**
* 复制Bean
* @param target
* @param source
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
public static void copyProperties(Object target, Object source) throws
InvocationTargetException, IllegalAccessException {
org.apache.commons.beanutils.BeanUtils.copyProperties(target, source);
}
}
beanutils复制javabean
最新推荐文章于 2023-08-15 16:20:24 发布