?? item.java
字號:
package com.tarena.shoppingcart.entity;import java.io.*;public class Item implements Serializable { private Integer id; private Product product; private Integer number; private double cost; public void setNumber(Integer number) { this.number = number; } public Item(Product product, Integer number, double cost) { super(); this.product = product; this.number = number; this.cost = cost; } public Item() { super(); } 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 Integer 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 int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((id == null) ? 0 : id.hashCode()); result = PRIME * result + ((product == null) ? 0 : product.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final Item other = (Item) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (product == null) { if (other.product != null) return false; } else if (!product.equals(other.product)) return false; return true; } @Override public String toString() { return product.getName()+":"+product.getDescription()+number+cost; } }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -