]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 19 Mar 2018 21:59:06 +0000 (22:59 +0100)
committerRoland Häder <roland@mxchange.org>
Mon, 19 Mar 2018 23:02:45 +0000 (00:02 +0100)
- Objects.equals() is an overdose here, as a possible null-reference has
  already been checked before
- CoreNumberUtils was a bad name, SafeNumberUtils is maybe better?

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java
src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java
src/org/mxchange/jcontactsbusiness/model/department/BusinessDepartment.java
src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java
src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java
src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java
src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java
src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java

index 8537001f49229a6759a9a286204dcf55db85ebc2..f2d83a359f08a30ad95ab15e8d68182d84d4f819 100644 (file)
@@ -203,11 +203,11 @@ public class BusinessBasicData implements BasicData {
 
        @Override
        public int compareTo (final BasicData basicData) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == basicData) {
                        // Should not happen
                        throw new NullPointerException("basicData is null"); //NOI18N
-               } else if (Objects.equals(this, basicData)) {
+               } else if (basicData.equals(this)) {
                        // Same object
                        return 0;
                }
index e5e187752860b746d5d432092abb962e78adf5af..d7c4ae641316e868c1ea0bf5f5a85133e5b35156 100644 (file)
@@ -46,7 +46,7 @@ import org.mxchange.jcontactsbusiness.model.employee.Employees;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcoreutils.Comparables;
-import org.mxchange.jcoreutils.CoreNumberUtils;
+import org.mxchange.jcoreutils.SafeNumberUtils;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -294,11 +294,11 @@ public class BusinessBranchOffice implements BranchOffice {
 
        @Override
        public int compareTo (final BranchOffice branchOffice) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == branchOffice) {
                        // Should not happen
                        throw new NullPointerException("branchOffice is null"); //NOI18N
-               } else if (Objects.equals(this, branchOffice)) {
+               } else if (branchOffice.equals(this)) {
                        // Same object
                        return 0;
                }
@@ -308,7 +308,7 @@ public class BusinessBranchOffice implements BranchOffice {
                        // First compare basic data
                        this.getBranchCompany().compareTo(branchOffice.getBranchCompany()),
                        // ... branch office number
-                       CoreNumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()),
+                       SafeNumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()),
                        // ... contact person
                        Employees.compare(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee()),
                        // ... then country
@@ -322,13 +322,13 @@ public class BusinessBranchOffice implements BranchOffice {
                        // ... and house number
                        this.getBranchHouseNumber().compareTo(branchOffice.getBranchHouseNumber()),
                        // ... and house number
-                       CoreNumberUtils.compare(this.getBranchLastHouseNumber(), branchOffice.getBranchLastHouseNumber()),
+                       SafeNumberUtils.compare(this.getBranchLastHouseNumber(), branchOffice.getBranchLastHouseNumber()),
                        // ... and extension
                        StringUtils.compareIgnoreCase(this.getBranchHouseNumberExtension(), branchOffice.getBranchHouseNumberExtension()),
                        // ... store ...
-                       CoreNumberUtils.compare(this.getBranchStore(), branchOffice.getBranchStore()),
+                       SafeNumberUtils.compare(this.getBranchStore(), branchOffice.getBranchStore()),
                        // ... suite number ...
-                       CoreNumberUtils.compare(this.getBranchSuiteNumber(), branchOffice.getBranchSuiteNumber())
+                       SafeNumberUtils.compare(this.getBranchSuiteNumber(), branchOffice.getBranchSuiteNumber())
                };
 
                // Check all values
index ce7d515c5e90fe354d4291ec8f895fe36ef0f2e2..b41bf9d80b3b1f6fa8f219949822b5832ffbbc5d 100644 (file)
@@ -162,11 +162,11 @@ public class BusinessDepartment implements Department {
 
        @Override
        public int compareTo (final Department department) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == department) {
                        // Should not happen
                        throw new NullPointerException("department is null"); //NOI18N
-               } else if (Objects.equals(this, department)) {
+               } else if (department.equals(this)) {
                        // Same object
                        return 0;
                }
index 63b32579033f3f80475a4881f01d93e83b8d2f0b..4d4da0a4a6c862afbada818c24aa4e48ecb0656b 100644 (file)
@@ -202,11 +202,11 @@ public class BusinessEmployee implements Employable {
 
        @Override
        public int compareTo (final Employable employable) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == employable) {
                        // Should not happen
                        throw new NullPointerException("employable is null"); //NOI18N
-               } else if (Objects.equals(this, employable)) {
+               } else if (employable.equals(this)) {
                        // Same object
                        return 0;
                }
index e4ed13b64d8dd85935a2980ed4824b9bbc952112..7a546ae46c6ab90b459584c2ff918449a345222a 100644 (file)
@@ -43,7 +43,7 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcoreutils.Comparables;
-import org.mxchange.jcoreutils.CoreNumberUtils;
+import org.mxchange.jcoreutils.SafeNumberUtils;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -272,11 +272,11 @@ public class BusinessHeadquarter implements Headquarter {
 
        @Override
        public int compareTo (final Headquarter headquarter) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == headquarter) {
                        // Should not happen
                        throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (Objects.equals(this, headquarter)) {
+               } else if (headquarter.equals(this)) {
                        // Same object
                        return 0;
                }
@@ -288,21 +288,21 @@ public class BusinessHeadquarter implements Headquarter {
                        // ... next country
                        this.getHeadquarterCountry().compareTo(headquarter.getHeadquarterCountry()),
                        // ... then ZIP code
-                       CoreNumberUtils.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
+                       SafeNumberUtils.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
                        // ... and city
                        this.getHeadquarterCity().compareTo(headquarter.getHeadquarterCity()),
                        // ... street name
                        StringUtils.compareIgnoreCase(this.getHeadquarterStreet(), headquarter.getHeadquarterStreet()),
                        // ... house number
-                       CoreNumberUtils.compare(this.getHeadquarterHouseNumber(), headquarter.getHeadquarterHouseNumber()),
+                       SafeNumberUtils.compare(this.getHeadquarterHouseNumber(), headquarter.getHeadquarterHouseNumber()),
                        // ... last house number
-                       CoreNumberUtils.compare(this.getHeadquarterLastHouseNumber(), headquarter.getHeadquarterLastHouseNumber()),
+                       SafeNumberUtils.compare(this.getHeadquarterLastHouseNumber(), headquarter.getHeadquarterLastHouseNumber()),
                        // ... extension
                        StringUtils.compareIgnoreCase(this.getHeadquarterHouseNumberExtension(), headquarter.getHeadquarterHouseNumberExtension()),
                        // ... store number
-                       CoreNumberUtils.compare(this.getHeadquarterStore(), headquarter.getHeadquarterStore()),
+                       SafeNumberUtils.compare(this.getHeadquarterStore(), headquarter.getHeadquarterStore()),
                        // ... suite number
-                       CoreNumberUtils.compare(this.getHeadquarterSuiteNumber(), headquarter.getHeadquarterSuiteNumber()),
+                       SafeNumberUtils.compare(this.getHeadquarterSuiteNumber(), headquarter.getHeadquarterSuiteNumber()),
                        // ... last email address
                        StringUtils.compareIgnoreCase(this.getHeadquarterEmailAddress(), headquarter.getHeadquarterEmailAddress())
                };
index c4b06c34f78fb879c9e1305c69955a6ae2889450..7c6e933d396f7282ff674541770c0f16dad952b5 100644 (file)
@@ -80,11 +80,11 @@ public class EmployeePosition implements JobPosition {
 
        @Override
        public int compareTo (final JobPosition jobPosition) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == jobPosition) {
                        // Should not happen
                        throw new NullPointerException("jobPosition is null"); //NOI18N
-               } else if (Objects.equals(this, jobPosition)) {
+               } else if (jobPosition.equals(this)) {
                        // Same object
                        return 0;
                }
index 1b3cc9ea3f8d861a5d488af5aaee90cb59767e24..6dba172f3deca9b165ffc9a977c89b1260dafd68 100644 (file)
@@ -83,11 +83,11 @@ public class BusinessLogo implements Logo {
 
        @Override
        public int compareTo (final Logo logo) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == logo) {
                        // Should not happen
                        throw new NullPointerException("logo is null"); //NOI18N
-               } else if (Objects.equals(this, logo)) {
+               } else if (logo.equals(this)) {
                        // Same object
                        return 0;
                }
index 16d0554fc7cce02b991fed3727a8b1d0892bac60..5c10af79ab4c8013b72e412ceefbce63d8a8a810 100644 (file)
@@ -128,11 +128,11 @@ public class BusinessOpeningTime implements OpeningTime {
 
        @Override
        public int compareTo (final OpeningTime openingTime) {
-               // For performance reasons
+               // Check parameter on null-reference and equality to this
                if (null == openingTime) {
                        // Should not happen
                        throw new NullPointerException("openingTime is null"); //NOI18N
-               } else if (Objects.equals(this, openingTime)) {
+               } else if (openingTime.equals(this)) {
                        // Same object
                        return 0;
                }