]> git.mxchange.org Git - jfinancials-core.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Fri, 24 Apr 2020 16:36:17 +0000 (18:36 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 24 Apr 2020 16:36:17 +0000 (18:36 +0200)
- added all fields (except primary key) for equals()/hashCode(). It should be
  possible to distinguish two entities without comparing the primary key.
- Or? Hmm ...

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItem.java

index 31d2d855db107af6663df6a911015a3d0a514e50..379d455ebcdd152a935e9f8ab20c52a1f917fa93 100644 (file)
@@ -248,7 +248,17 @@ public class FinancialReceiptItem implements BillableReceiptItem {
 
                final BillableReceiptItem receiptItem = (BillableReceiptItem) object;
 
-               if (!Objects.equals(this.getItemId(), receiptItem.getItemId())) {
+               if (!Objects.equals(this.getItemBrandName(), receiptItem.getItemBrandName())) {
+                       return false;
+               } else if (!Objects.equals(this.getItemCouponNumber(), receiptItem.getItemCouponNumber())) {
+                       return false;
+               } else if (!Objects.equals(this.getItemGrossPrice(), receiptItem.getItemGrossPrice())) {
+                       return false;
+               } else if (!Objects.equals(this.getItemIsDiscount(), receiptItem.getItemIsDiscount())) {
+                       return false;
+               } else if (!Objects.equals(this.getItemIsRefund(), receiptItem.getItemIsRefund())) {
+                       return false;
+               } else if (!Objects.equals(this.getItemManufacturer(), receiptItem.getItemManufacturer())) {
                        return false;
                } else if (!Objects.equals(this.getItemNumber(), receiptItem.getItemNumber())) {
                        return false;
@@ -258,7 +268,7 @@ public class FinancialReceiptItem implements BillableReceiptItem {
                        return false;
                } else if (!Objects.equals(this.getItemReceipt(), receiptItem.getItemReceipt())) {
                        return false;
-               } else if (!Objects.equals(this.getItemCouponNumber(), receiptItem.getItemCouponNumber())) {
+               } else if (!Objects.equals(this.getItemTaxRate(), receiptItem.getItemTaxRate())) {
                        return false;
                }
 
@@ -423,12 +433,18 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        public int hashCode () {
                int hash = 5;
 
+               hash = 53 * hash + Objects.hashCode(this.getItemBrandName());
+               hash = 53 * hash + Objects.hashCode(this.getItemCouponNumber());
+               hash = 53 * hash + Objects.hashCode(this.getItemGrossPrice());
                hash = 53 * hash + Objects.hashCode(this.getItemId());
+               hash = 53 * hash + Objects.hashCode(this.getItemIsDiscount());
+               hash = 53 * hash + Objects.hashCode(this.getItemIsRefund());
+               hash = 53 * hash + Objects.hashCode(this.getItemManufacturer());
                hash = 53 * hash + Objects.hashCode(this.getItemNumber());
                hash = 53 * hash + Objects.hashCode(this.getItemProduct());
                hash = 53 * hash + Objects.hashCode(this.getItemProductQuantity());
                hash = 53 * hash + Objects.hashCode(this.getItemReceipt());
-               hash = 53 * hash + Objects.hashCode(this.getItemCouponNumber());
+               hash = 53 * hash + Objects.hashCode(this.getItemTaxRate());
 
                return hash;
        }