]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 6 Oct 2022 14:01:20 +0000 (16:01 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 6 Oct 2022 14:01:20 +0000 (16:01 +0200)
- use own *Utils' methods instead of direct invocation (null-safe)
- used more Objects.equals() (yes, a bit silly here)

src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java
src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java
src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java
src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java
src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java

index dbd25c51ffcfa78653a7cd2413e2bfbbbdb363f0..9eb4a4e0b76420029efbf7f0507f3d3543ef9fea 100644 (file)
@@ -225,7 +225,7 @@ public class BusinessBasicData implements BasicData {
                if (null == basicData) {
                        // Should not happen
                        throw new NullPointerException("basicData is null"); //NOI18N
-               } else if (basicData.equals(this)) {
+               } else if (Objects.equals(this, basicData)) {
                        // Same object
                        return 0;
                }
index 66f92007e8f0622343f91c1ca0e53b1d8c0d31ed..2beb8f20a2ec007d8ecb695e127b5241878099a9 100644 (file)
@@ -50,6 +50,7 @@ import org.mxchange.jcoreutils.Comparables;
 import org.mxchange.jcoreutils.SafeNumberUtils;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
+import org.mxchange.jcountry.model.utils.CountryUtils;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
@@ -317,14 +318,13 @@ public class BusinessBranchOffice implements BranchOffice {
                if (null == branchOffice) {
                        // Should not happen
                        throw new NullPointerException("branchOffice is null"); //NOI18N
-               } else if (branchOffice.equals(this)) {
+               } else if (Objects.equals(this, branchOffice)) {
                        // Same object
                        return 0;
                }
 
                // Init comparisons
                final int[] comparators = {
-                       // First compare basic data
                        // First compare basic data
                        this.getBranchCompany().compareTo(branchOffice.getBranchCompany()),
                        // ... branch office number
@@ -334,7 +334,7 @@ public class BusinessBranchOffice implements BranchOffice {
                        // ... contact person
                        ContactUtils.compare(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee()),
                        // ... then country
-                       this.getBranchCountry().compareTo(branchOffice.getBranchCountry()),
+                       CountryUtils.compare(this.getBranchCountry(), branchOffice.getBranchCountry()),
                        // ... next city
                        this.getBranchCity().compareToIgnoreCase(branchOffice.getBranchCity()),
                        // ... then ZIP code
index 36c8f2002d9134771231aeac905f0178cd1b0cb9..7d90754156f64c8647d9ac3e06cbc5e06e0d3cb3 100644 (file)
@@ -46,6 +46,7 @@ import org.mxchange.jcoreutils.Comparables;
 import org.mxchange.jcoreutils.SafeNumberUtils;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
+import org.mxchange.jcountry.model.utils.CountryUtils;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
@@ -294,7 +295,7 @@ public class BusinessHeadquarter implements Headquarter {
                if (null == headquarter) {
                        // Should not happen
                        throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (headquarter.equals(this)) {
+               } else if (Objects.equals(this, headquarter)) {
                        // Same object
                        return 0;
                }
@@ -304,7 +305,7 @@ public class BusinessHeadquarter implements Headquarter {
                        // First check company name
                        this.getHeadquarterCompanyName().compareTo(headquarter.getHeadquarterCompanyName()),
                        // ... next country
-                       this.getHeadquarterCountry().compareTo(headquarter.getHeadquarterCountry()),
+                       CountryUtils.compare(this.getHeadquarterCountry(), headquarter.getHeadquarterCountry()),
                        // ... then ZIP code
                        SafeNumberUtils.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
                        // ... and city
index ae98fdebbf5c446eda14b50d295bcfd5ec345aef..ba4940299f0b795e83444dae177b77a7f32b253c 100644 (file)
@@ -96,7 +96,7 @@ public class BusinessLogo implements Logo {
                if (null == logo) {
                        // Should not happen
                        throw new NullPointerException("logo is null"); //NOI18N
-               } else if (logo.equals(this)) {
+               } else if (Objects.equals(this, logo)) {
                        // Same object
                        return 0;
                }
index 6720514013072f504358ae5b7a26401ffa0748d7..5b70ede7d6474b3897d2eb2afdcffcbfa3b0011c 100644 (file)
@@ -157,7 +157,7 @@ public class BusinessOpeningTime implements OpeningTime {
                if (null == openingTime) {
                        // Should not happen
                        throw new NullPointerException("openingTime is null"); //NOI18N
-               } else if (openingTime.equals(this)) {
+               } else if (Objects.equals(this, openingTime)) {
                        // Same object
                        return 0;
                }