Beispiel #1
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((amount == null) ? 0 : amount.hashCode());
   result = prime * result + ((product == null) ? 0 : product.hashCode());
   result = prime * result + quantity;
   return result;
 }
Beispiel #2
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   OrderItem other = (OrderItem) obj;
   if (amount == null) {
     if (other.amount != null) return false;
   } else if (!amount.equals(other.amount)) return false;
   if (product == null) {
     if (other.product != null) return false;
   } else if (!product.equals(other.product)) return false;
   if (quantity != other.quantity) return false;
   return true;
 }
Beispiel #3
0
 public BigDecimal computeAmount() {
   this.amount = product.getPrice().multiply(new BigDecimal(quantity));
   return this.amount;
 }