主要代码
定义2个bean对象:
public class copyPropertiesData1 {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
public class copyPropertiesData2 {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
分别使用BeanUtils、PropertyUtils、BeanCopier转化1000个对象:
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.PropertyUtils;
import net.sf.cglib.beans.BeanCopier;
//import org.springframework.beans.BeanUtils;
public class copyPropertiesCompare {
final static List entityList;
static{
entityList = new ArrayList();
for (int i = 0; i < 10; i++) {
copyPropertiesData1 entity = new copyPropertiesData1();
entityList.add(entity);