From 89988c95728960ace1b4d8ba515ec3b6907c65cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 6 Oct 2022 16:16:47 +0200 Subject: [PATCH] Continued: - renamed utilities class Customers to CustomerUtils - moved it to own package --- .../jcustomercore/model/customer/ContactCustomer.java | 9 +++++---- .../Customers.java => utils/CustomerUtils.java} | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) rename src/org/mxchange/jcustomercore/model/{customer/Customers.java => utils/CustomerUtils.java} (96%) diff --git a/src/org/mxchange/jcustomercore/model/customer/ContactCustomer.java b/src/org/mxchange/jcustomercore/model/customer/ContactCustomer.java index 04daa5d..81f12fa 100644 --- a/src/org/mxchange/jcustomercore/model/customer/ContactCustomer.java +++ b/src/org/mxchange/jcustomercore/model/customer/ContactCustomer.java @@ -39,6 +39,7 @@ import javax.persistence.Transient; import org.apache.commons.lang3.StringUtils; import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jcontacts.model.contact.UserContact; +import org.mxchange.jcontacts.model.utils.ContactUtils; import org.mxchange.jcoreutils.Comparables; import org.mxchange.jcustomercore.model.customer.status.CustomerAccountStatus; @@ -168,8 +169,8 @@ public class ContactCustomer implements Customer { // Check parameter on null-reference and equality to this if (null == customer) { // Should not happen - throw new NullPointerException("customer is null"); //NOI18N - } else if (customer.equals(this)) { + throw new NullPointerException("Parameter 'customer' is null"); //NOI18N + } else if (Objects.equals(this, customer)) { // Same object return 0; } @@ -177,9 +178,9 @@ public class ContactCustomer implements Customer { // Init comparators final int comparators[] = { // First check contact instance - this.getCustomerContact().compareTo(customer.getCustomerContact()), + ContactUtils.compare(this.getCustomerContact(), customer.getCustomerContact()), // ... then customer number - this.getCustomerNumber().compareTo(customer.getCustomerNumber()), + StringUtils.compare(this.getCustomerNumber(), customer.getCustomerNumber()), // ... last is confirmation key StringUtils.compare(this.getCustomerConfirmKey(), customer.getCustomerConfirmKey()) }; diff --git a/src/org/mxchange/jcustomercore/model/customer/Customers.java b/src/org/mxchange/jcustomercore/model/utils/CustomerUtils.java similarity index 96% rename from src/org/mxchange/jcustomercore/model/customer/Customers.java rename to src/org/mxchange/jcustomercore/model/utils/CustomerUtils.java index d9da596..7558e91 100644 --- a/src/org/mxchange/jcustomercore/model/customer/Customers.java +++ b/src/org/mxchange/jcustomercore/model/utils/CustomerUtils.java @@ -14,20 +14,21 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcustomercore.model.customer; +package org.mxchange.jcustomercore.model.utils; import java.security.SecureRandom; import java.text.MessageFormat; import java.util.Objects; import java.util.Random; import org.apache.commons.lang3.StringUtils; +import org.mxchange.jcustomercore.model.customer.Customer; /** * Customer utilities *

* @author Roland Häder */ -public class Customers { +public class CustomerUtils { /** * Random number generator @@ -158,7 +159,7 @@ public class Customers { /** * No constructors for utility classes */ - private Customers () { + private CustomerUtils () { } } -- 2.39.5