]> git.mxchange.org Git - jfinancials-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 17 Oct 2017 21:14:23 +0000 (23:14 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 17 Oct 2017 21:14:23 +0000 (23:14 +0200)
- added documentation

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

index a386d9b0c03415c0553daf1085c2051305b46bf0..1f7fd23e665dbce1f982bfb1fb6fee9979a33b76 100644 (file)
@@ -32,7 +32,16 @@ public class ReceiptItems implements Serializable {
         */
        private static final long serialVersionUID = 2_867_938_676_165_402L;
 
-       public static boolean isSameReceipt (final BillableReceiptItem receiptItem1, final BillableReceiptItem receiptItem2) {
+       /**
+        * Checks if both receipt items are the same by assigned receipt, product
+        * and quantity.
+        * <p>
+        * @param receiptItem1 Receipt item 1
+        * @param receiptItem2 Receipt item 2
+        * <p>
+        * @return Whether both are equal
+        */
+       public static boolean isSameReceiptItem (final BillableReceiptItem receiptItem1, final BillableReceiptItem receiptItem2) {
                // Pre-compare both as entities (same id)
                if (Objects.equals(receiptItem1, receiptItem2)) {
                        // Same entity (with id number)
@@ -42,55 +51,55 @@ public class ReceiptItems implements Serializable {
                // Validate parameter
                if (null == receiptItem1) {
                        // Throw NPE
-                       throw new NullPointerException("receiptItem1 is null");
+                       throw new NullPointerException("receiptItem1 is null"); //NOI18N
                } else if ((receiptItem1.getItemId() instanceof Long) && (receiptItem1.getItemId() < 1)) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("receiptItem1.itemId={0} is not valid.", receiptItem1.getItemId()));
-               } else if (receiptItem1.getItemReceipt()== null) {
+                       throw new IllegalArgumentException(MessageFormat.format("receiptItem1.itemId={0} is not valid.", receiptItem1.getItemId())); //NOI18N
+               } else if (receiptItem1.getItemReceipt() == null) {
                        // Throw NPE
-                       throw new NullPointerException("receiptItem1.itemReceipt is null");
+                       throw new NullPointerException("receiptItem1.itemReceipt is null"); //NOI18N
                } else if (receiptItem1.getItemReceipt().getReceiptId() == null) {
                        // Throw NPE
-                       throw new NullPointerException("receiptItem1.itemReceipt.receiptId is null");
+                       throw new NullPointerException("receiptItem1.itemReceipt.receiptId is null"); //NOI18N
                } else if (receiptItem1.getItemReceipt().getReceiptId() < 1) {
                        // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("receiptItem1.itemReceipt.receiptId={0} is not valid", receiptItem1.getItemReceipt().getReceiptId()));
+                       throw new NullPointerException(MessageFormat.format("receiptItem1.itemReceipt.receiptId={0} is not valid", receiptItem1.getItemReceipt().getReceiptId())); //NOI18N
                } else if (receiptItem1.getItemProduct() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("receiptItem1.itemProduct is null.");
+                       throw new NullPointerException("receiptItem1.itemProduct is null."); //NOI18N
                } else if (receiptItem1.getItemProduct().getProductId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("receiptItem1.itemProduct.productId is null.");
+                       throw new NullPointerException("receiptItem1.itemProduct.productId is null."); //NOI18N
                } else if (receiptItem1.getItemProduct().getProductId() < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("receiptItem1.itemProduct.productId={0} is invalid.", receiptItem1.getItemProduct().getProductId()));
+                       throw new IllegalArgumentException(MessageFormat.format("receiptItem1.itemProduct.productId={0} is invalid.", receiptItem1.getItemProduct().getProductId())); //NOI18N
                } else if (null == receiptItem2) {
                        // Throw NPE
-                       throw new NullPointerException("receiptItem2 is null");
+                       throw new NullPointerException("receiptItem2 is null"); //NOI18N
                } else if ((receiptItem2.getItemId() instanceof Long) && (receiptItem2.getItemId() < 1)) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("receiptItem2.itemId={0} is not valid.", receiptItem2.getItemId()));
-               } else if (receiptItem2.getItemReceipt()== null) {
+                       throw new IllegalArgumentException(MessageFormat.format("receiptItem2.itemId={0} is not valid.", receiptItem2.getItemId())); //NOI18N
+               } else if (receiptItem2.getItemReceipt() == null) {
                        // Throw NPE
-                       throw new NullPointerException("receiptItem2.itemReceipt is null");
+                       throw new NullPointerException("receiptItem2.itemReceipt is null"); //NOI18N
                } else if (receiptItem2.getItemReceipt().getReceiptId() == null) {
                        // Throw NPE
-                       throw new NullPointerException("receiptItem2.itemReceipt.receiptId is null");
+                       throw new NullPointerException("receiptItem2.itemReceipt.receiptId is null"); //NOI18N
                } else if (receiptItem2.getItemReceipt().getReceiptId() < 1) {
                        // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("receiptItem2.itemReceipt.receiptId={0} is not valid", receiptItem2.getItemReceipt().getReceiptId()));
+                       throw new NullPointerException(MessageFormat.format("receiptItem2.itemReceipt.receiptId={0} is not valid", receiptItem2.getItemReceipt().getReceiptId())); //NOI18N
                } else if (receiptItem2.getItemProduct() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("receiptItem2.itemProduct is null.");
+                       throw new NullPointerException("receiptItem2.itemProduct is null."); //NOI18N
                } else if (receiptItem2.getItemProduct().getProductId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("receiptItem2.itemProduct.productId is null.");
+                       throw new NullPointerException("receiptItem2.itemProduct.productId is null."); //NOI18N
                } else if (receiptItem2.getItemProduct().getProductId() < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("receiptItem2.itemProduct.productId={0} is invalid.", receiptItem2.getItemProduct().getProductId()));
+                       throw new IllegalArgumentException(MessageFormat.format("receiptItem2.itemProduct.productId={0} is invalid.", receiptItem2.getItemProduct().getProductId())); //NOI18N
                } else if (null == receiptItem2) {
                        // Throw NPE
-                       throw new NullPointerException("receiptItem2 is null");
+                       throw new NullPointerException("receiptItem2 is null"); //NOI18N
                }
 
                // Now check all individually