我有一個類,如:不能訪問類字段
class CustomerData{
int ssn;
int homePhone;
int officePhone;
String ProductCode;
String product;
String sameAsPrev=null;
String ProductDescription;
String ForwardProduct;
// set/get methods }
there is a Controller Class:
------------------------------
in a method customerInfoContinue() {
customerData customerData=new CustomerData();
customerData.setSsn(customerForm.getSsn);
customerData.setHomePhone(cuatomerForm.getHomePhone());
.
.
.
.
customerData.setProductDescription((String)session.getAttribute("Product Description"));
customerData.setProductDescription((String)session.getAttribute("Forward Product"));
after setting values Map has been created like this:
Map<String,CustomerData> customerDataMap=new LinkedHashMap<String,CustomerData>();
//setting product code as key
CustomerDataMap.put(customerForm.getProductCode,customerData);
}
和無處不在JSP中,他們已經用這種CustomerDataMap。現在
的問題是: 我必須要改變CustomerData類與Customer類。
但在Customer class 2字段中ProductDescription和ForwardProduct不可用。客戶類也是一個jar文件,所以我不能更改字段。
請諮詢東西如何擺脫這個問題..
感謝您的回覆Bjorn.but我需要替換CustomerData類。所以不允許擴展customerData。 – kmme 2011-04-04 11:53:13
那麼我想你沒有別的選擇,只能確保班級在罐子裏更新。 – 2011-04-04 12:12:20