📄 shoppingcartitem.java
字号:
package com.free.struts.storefront.framework;
import com.free.struts.storefront.catalog.view.ItemDetailView;
/**
* <p>Title: Eclipse Plugin Development</p>
* <p>Description: Free download</p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: Free</p>
* @author gan.shu.man
* @version 1.0
*/
public class ShoppingCartItem {
public void setItem(ItemDetailView newItem) {
item = newItem;
calculateExtendedPrice();
}
public void setExtendedPrice(double newPrice) {
extendedPrice = newPrice;
}
public String getDescription() {
return item.getDescription();
}
public String getId() {
return item.getId();
}
public String getName() {
return item.getName();
}
public ShoppingCartItem(ItemDetailView item, int qty) {
this.item = item;
this.quantity = qty;
calculateExtendedPrice();
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int newQuantity) {
quantity = newQuantity;
calculateExtendedPrice();
}
public ItemDetailView getItem() {
return item;
}
public Double getUnitPrice() {
return item.getUnitPrice();
}
public double getExtendedPrice() {
return extendedPrice;
}
private void calculateExtendedPrice() {
if (item.getUnitPrice() != null) {
extendedPrice = item.getUnitPrice().doubleValue() * getQuantity();
}
}
// Extended price is unit price * qty
private double extendedPrice = 0.0;
private ItemDetailView item = null;
// Default qty to 1
private int quantity = 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -