コード例 #1
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   OrderProduct other = (OrderProduct) obj;
   if (finalPrice == null) {
     if (other.finalPrice != null) return false;
   } else if (!finalPrice.equals(other.finalPrice)) return false;
   if (id == null) {
     if (other.id != null) return false;
   } else if (!id.equals(other.id)) return false;
   if (order == null) {
     if (other.order != null) return false;
   } else if (!order.equals(other.order)) return false;
   if (product == null) {
     if (other.product != null) return false;
   } else if (!product.equals(other.product)) return false;
   if (productsModel == null) {
     if (other.productsModel != null) return false;
   } else if (!productsModel.equals(other.productsModel)) return false;
   if (productsName == null) {
     if (other.productsName != null) return false;
   } else if (!productsName.equals(other.productsName)) return false;
   if (productsPrice == null) {
     if (other.productsPrice != null) return false;
   } else if (!productsPrice.equals(other.productsPrice)) return false;
   if (productsQuantity != other.productsQuantity) return false;
   if (productsTax == null) {
     if (other.productsTax != null) return false;
   } else if (!productsTax.equals(other.productsTax)) return false;
   return true;
 }
コード例 #2
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((finalPrice == null) ? 0 : finalPrice.hashCode());
   result = prime * result + ((id == null) ? 0 : id.hashCode());
   result = prime * result + ((order == null) ? 0 : order.hashCode());
   result = prime * result + ((product == null) ? 0 : product.hashCode());
   result = prime * result + ((productsModel == null) ? 0 : productsModel.hashCode());
   result = prime * result + ((productsName == null) ? 0 : productsName.hashCode());
   result = prime * result + ((productsPrice == null) ? 0 : productsPrice.hashCode());
   result = prime * result + productsQuantity;
   result = prime * result + ((productsTax == null) ? 0 : productsTax.hashCode());
   return result;
 }