请问有没有什么工具类可以深copy一个对象?
String temp = null;List<String> tempList = new ArrayList<String>();
List<List<String>> data = new ArrayList<List<String>>();
if(name.equals("deposit")){
//获得OpReveDeposit对象集合
List deposits = reveDepositService.findDeposits(projSerialId);
data.add(getTableHead(name));
for (int i = 0; i < deposits.size(); i++) {
OpReveDeposit deposit = (OpReveDeposit)deposits.get(i);
tempList.add(i+1+"");//序号
temp = deposit.getDepositMoney() + "";//保证金金额(万元)
tempList.add(temp);
temp = deposit.getAccrHolder();//利息所有方
tempList.add(temp);
temp = deposit.getYinteRate() + "";//年利率(利息)(%)
tempList.add(temp);
temp = deposit.getMoneyTaker();//保证金收取方
tempList.add(temp);
data.add(tempList);//必须深copy List。。。。
tempList.clear();
}
}
代码如上。。。需要把list<OpReveDeposit >封装成List<List<String>>