⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cartitem.java

📁 工厂版本管理系统,STRUTS2框架,用于管理商品的版本,便于有效的控制版本
💻 JAVA
字号:
package com.bluesky.elecall.domain.cart;import java.math.BigDecimal;import com.bluesky.elecall.domain.Product;public class CartItem {	//if productId is invalid, then product is null	private Product product;	private String productId;	private long quantity;	public CartItem() {			}	public CartItem(String productId, long quantity) {		this.productId = productId;		this.quantity = quantity;	}	public Product getProduct() {		return product;	}	public void setProduct(Product product) {		this.product = product;	}	public long getQuantity() {		return quantity;	}	public void setQuantity(long quantity) {		this.quantity = quantity;	}	public String getProductId() {		return productId;	}	public void setProductId(String productId) {		this.productId = productId;	}	public void increaseQuantity(long quantity) {		this.quantity += quantity;	}	public BigDecimal getAmount() {		return product.getUnitPrice(quantity).multiply(new BigDecimal(quantity));	}	public boolean isEmpty() {		if(productId==null || productId.equals("")	|| quantity==0)			return true;				return false;	}		public BigDecimal getUnitPrice()	{		return product.getUnitPrice(quantity);	}		public boolean isValid(){		if(product!=null && product.getName().length()>0)			return true;		else			return false;			}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -