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

📄 item.java

📁 项目是实现网络购物功能
💻 JAVA
字号:
package com.tarena.shoppingcart.model;

import java.io.Serializable;

public class Item implements Serializable {
	private Integer id; 
	private Product product;
	private int number;
	private double cost;
	
	public Item(){
		
	}

	public double getCost() {
		return cost;
	}

	public void setCost(double cost) {
		this.cost = cost;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@Override
	public boolean equals(Object o) {
		if(o==null) return false;
		if(o==this) return true;
		if(!(o instanceof Item)) return false;
		Item i = (Item)o;
		if(i.id!=null || this.id!=null) return this.id.equals(i.id);
		if(i.product!=null || this.product!=null) return this.product.getId().equals(i.product.getId());
		return true;
	}

	@Override
	public int hashCode() {
		return id==null ? 0 :id.hashCode();
	}

}

⌨️ 快捷键说明

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