From 5ff6f8e4806ab375fa8fc1a2b6983f04e62de87d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 14 Apr 2020 09:40:02 +0200 Subject: [PATCH] Continued: - DialableMobileNumber no longer depends on DialableNumber and provides now getter for mobileId and mobileNumber instead of phoneId and phoneNumber - renamed copyAll() to copySomeFoo() for better accuracy - moved isSameFooBar() to proper FooBars utilities class - implemented java.lang.Comparable to have sorting possible e.g. in p:dataTable PrimeFaces tag - always validate parameter in contructors and public/protected methods - renamed phone_entry_created to fax_entry_created - fooEntryUpdated is always not insertable, while fooEntryCreated is never updatable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../PhoneNumberAlreadyLinkedException.java | 8 +- .../phone/PhoneNumberNotLinkedException.java | 8 +- .../phonenumbers/fax/DialableFaxNumber.java | 2 +- .../model/phonenumbers/fax/FaxNumber.java | 75 ++++++-- .../model/phonenumbers/fax/FaxNumbers.java | 28 ++- .../landline/DialableLandLineNumber.java | 2 +- .../phonenumbers/landline/LandLineNumber.java | 85 +++++++-- .../landline/LandLineNumbers.java | 28 ++- .../mobile/DialableMobileNumber.java | 61 ++++++- .../phonenumbers/mobile/MobileNumber.java | 166 ++++++++++-------- .../phonenumbers/mobile/MobileNumbers.java | 33 +++- .../mobileprovider/CellphoneProvider.java | 107 ++++++++--- .../mobileprovider/MobileProvider.java | 2 +- .../mobileprovider/MobileProviders.java | 2 +- src/org/mxchange/jphone/utils/PhoneUtils.java | 125 ------------- 15 files changed, 465 insertions(+), 267 deletions(-) delete mode 100644 src/org/mxchange/jphone/utils/PhoneUtils.java diff --git a/src/org/mxchange/jphone/exceptions/phone/PhoneNumberAlreadyLinkedException.java b/src/org/mxchange/jphone/exceptions/phone/PhoneNumberAlreadyLinkedException.java index 589b387..7aea5a0 100644 --- a/src/org/mxchange/jphone/exceptions/phone/PhoneNumberAlreadyLinkedException.java +++ b/src/org/mxchange/jphone/exceptions/phone/PhoneNumberAlreadyLinkedException.java @@ -35,7 +35,7 @@ public class PhoneNumberAlreadyLinkedException extends Exception { private static final long serialVersionUID = 18_964_581_681_985_598L; /** - * Counstructor with fax number + * Constructor with fax number *

* @param faxNumber Fax number */ @@ -45,7 +45,7 @@ public class PhoneNumberAlreadyLinkedException extends Exception { } /** - * Counstructor with landLine number + * Constructor with landLine number *

* @param landLineNumber Land-line number */ @@ -55,13 +55,13 @@ public class PhoneNumberAlreadyLinkedException extends Exception { } /** - * Counstructor with mobile number + * Constructor with mobile number *

* @param mobileNumber Mobile number */ public PhoneNumberAlreadyLinkedException (final DialableMobileNumber mobileNumber) { // Call super constructor with message - super(MessageFormat.format("mobileNumber={0} with phoneId={1} cannot be linked, link target has already mobile number linked.", mobileNumber, mobileNumber.getPhoneId())); //NOI18N + super(MessageFormat.format("mobileNumber={0} with phoneId={1} cannot be linked, link target has already mobile number linked.", mobileNumber, mobileNumber.getMobileId())); //NOI18N } } diff --git a/src/org/mxchange/jphone/exceptions/phone/PhoneNumberNotLinkedException.java b/src/org/mxchange/jphone/exceptions/phone/PhoneNumberNotLinkedException.java index 4552c18..dc8211c 100644 --- a/src/org/mxchange/jphone/exceptions/phone/PhoneNumberNotLinkedException.java +++ b/src/org/mxchange/jphone/exceptions/phone/PhoneNumberNotLinkedException.java @@ -35,7 +35,7 @@ public class PhoneNumberNotLinkedException extends Exception { private static final long serialVersionUID = 18_964_581_681_985_599L; /** - * Counstructor with fax number + * Constructor with fax number *

* @param faxNumber Fax number */ @@ -45,7 +45,7 @@ public class PhoneNumberNotLinkedException extends Exception { } /** - * Counstructor with landLine number + * Constructor with landLine number *

* @param landLineNumber Land-line number */ @@ -55,13 +55,13 @@ public class PhoneNumberNotLinkedException extends Exception { } /** - * Counstructor with mobile number + * Constructor with mobile number *

* @param mobileNumber Mobile number */ public PhoneNumberNotLinkedException (final DialableMobileNumber mobileNumber) { // Call super constructor with message - super(MessageFormat.format("mobileNumber={0} with phoneId={1} is not linked.", mobileNumber, mobileNumber.getPhoneId())); //NOI18N + super(MessageFormat.format("mobileNumber={0} with phoneId={1} is not linked.", mobileNumber, mobileNumber.getMobileId())); //NOI18N } } diff --git a/src/org/mxchange/jphone/model/phonenumbers/fax/DialableFaxNumber.java b/src/org/mxchange/jphone/model/phonenumbers/fax/DialableFaxNumber.java index 61238c0..75d3e3b 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/fax/DialableFaxNumber.java +++ b/src/org/mxchange/jphone/model/phonenumbers/fax/DialableFaxNumber.java @@ -23,7 +23,7 @@ import org.mxchange.jphone.model.phonenumbers.DialableNumber; *

* @author Roland Häder */ -public interface DialableFaxNumber extends DialableNumber { +public interface DialableFaxNumber extends Comparable, DialableNumber { @Override boolean equals (final Object object); diff --git a/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumber.java b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumber.java index ff9d400..d112496 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumber.java +++ b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumber.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.model.phonenumbers.fax; +import java.text.MessageFormat; import java.util.Date; import java.util.Objects; import javax.persistence.Basic; @@ -33,6 +34,7 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.mxchange.jcoreutils.Comparables; import org.mxchange.jcountry.model.data.Country; import org.mxchange.jcountry.model.data.CountryData; @@ -45,8 +47,7 @@ import org.mxchange.jcountry.model.data.CountryData; @Table (name = "fax_numbers") @NamedQueries ( { - @NamedQuery (name = "AllFaxNumbers", query = "SELECT f FROM fax_numbers AS f ORDER BY f.phoneId ASC"), - @NamedQuery (name = "SearchFaxNumberId", query = "SELECT f FROM fax_numbers AS f WHERE f.phoneId = :faxNumberId") + @NamedQuery (name = "AllFaxNumbers", query = "SELECT f FROM fax_numbers AS f ORDER BY f.phoneId ASC") } ) @SuppressWarnings ("PersistenceUnitPresent") @@ -84,7 +85,7 @@ public class FaxNumber implements DialableFaxNumber { * Timestamp when this entry has been created */ @Temporal (TemporalType.TIMESTAMP) - @Column (name = "phone_entry_updated", updatable = false) + @Column (name = "fax_entry_updated", insertable = false) private Date phoneEntryUpdated; /** @@ -111,20 +112,72 @@ public class FaxNumber implements DialableFaxNumber { /** * Constructor with country, area code and number *

- * @param faxCountry Country instance + * @param faxCountry Country instance * @param faxAreaCode Area code (without leading zeros) - * @param faxNumber Fax number (without area code and leading zero) + * @param faxNumber Fax number (without area code and leading zero) */ public FaxNumber (final Country faxCountry, final Integer faxAreaCode, final Long faxNumber) { - // Call default constructor + // Invoke default constructor this(); + // Are all parameter set? + if (null == faxAreaCode) { + // Throw NPE + throw new NullPointerException("faxAreaCode is null"); //NOI18N + } else if (faxAreaCode < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("faxAreaCode={0} is not valid.", faxAreaCode)); //NOI18N + } else if (null == faxCountry) { + // Throw NPE + throw new NullPointerException("faxCountry is null"); //NOI18N + } else if (null == faxCountry.getCountryId()) { + // Throw NPE again + throw new NullPointerException("faxCountry.countryId is null"); //NOI18N + } else if (faxCountry.getCountryId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("faxCountry.countryId={0} is not valid", faxCountry.getCountryId())); //NOI18N + } else if (null == faxNumber) { + // Throw NPE + throw new NullPointerException("faxNumber is null"); //NOI18N + } else if (faxNumber < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("faxNumber={0} is not valid.", faxNumber)); //NOI18N + } + // Set all values this.faxCountry = faxCountry; this.faxAreaCode = faxAreaCode; this.phoneNumber = faxNumber; } + @Override + public int compareTo (final DialableFaxNumber otherNumber) { + // Is the parameter given? + if (null == otherNumber) { + // Throw NPE + throw new NullPointerException("otherNumber is null"); //NOI18N + } else if (otherNumber.equals(this)) { + // Same object + return 0; + } + + // Init comparisons + final int[] comparators = { + // First country + this.getPhoneCountry().compareTo(otherNumber.getPhoneCountry()), + // Next area code + this.getPhoneAreaCode().compareTo(otherNumber.getPhoneAreaCode()), + // Last number + this.getPhoneNumber().compareTo(otherNumber.getPhoneNumber()) + }; + + // Check all values + final int comparison = Comparables.checkAll(comparators); + + // Return value + return comparison; + } + @Override public boolean equals (final Object object) { if (null == object) { @@ -133,15 +186,15 @@ public class FaxNumber implements DialableFaxNumber { return false; } - final DialableFaxNumber other = (DialableFaxNumber) object; + final DialableFaxNumber dialableFaxNumber = (DialableFaxNumber) object; - if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { + if (!Objects.equals(this.getPhoneNumber(), dialableFaxNumber.getPhoneNumber())) { return false; - } else if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { + } else if (!Objects.equals(this.getPhoneId(), dialableFaxNumber.getPhoneId())) { return false; - } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) { + } else if (!Objects.equals(this.getPhoneAreaCode(), dialableFaxNumber.getPhoneAreaCode())) { return false; - } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) { + } else if (!Objects.equals(this.getPhoneCountry(), dialableFaxNumber.getPhoneCountry())) { return false; } diff --git a/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java index 487d4c3..9ffdac4 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java +++ b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java @@ -17,6 +17,7 @@ package org.mxchange.jphone.model.phonenumbers.fax; import java.io.Serializable; +import java.util.Objects; /** * An utilities class for fax numbers @@ -36,7 +37,7 @@ public class FaxNumbers implements Serializable { * @param sourceNumber Source number object * @param targetNumber Target number object */ - public static void copyAll (final DialableFaxNumber sourceNumber, final DialableFaxNumber targetNumber) { + public static void copyFaxNumber (final DialableFaxNumber sourceNumber, final DialableFaxNumber targetNumber) { // Validate instance if (null == sourceNumber) { // Throw NPE @@ -54,6 +55,31 @@ public class FaxNumbers implements Serializable { targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); } + /** + * Checks if both are the same + *

+ * @param faxNumber First fax number + * @param otherNumber Second fax number + *

+ * @return Whether both are the same + */ + public static boolean isSameFaxNumber (final DialableFaxNumber faxNumber, DialableFaxNumber otherNumber) { + // Test object equality first + if (Objects.equals(faxNumber, otherNumber)) { + // Both the same object (null/null or same object) + return true; + } else if (((null == faxNumber) && (otherNumber instanceof DialableFaxNumber)) || ((null == otherNumber) && (faxNumber instanceof DialableFaxNumber))) { + // One is null the other not + return false; + } + // Now compare deeper + final boolean sameCountry = Objects.equals(faxNumber.getPhoneCountry(), otherNumber.getPhoneCountry()); + final boolean sameAreaCode = Objects.equals(faxNumber.getPhoneAreaCode(), otherNumber.getPhoneAreaCode()); + final boolean sameNumber = Objects.equals(faxNumber.getPhoneNumber(), otherNumber.getPhoneNumber()); + // All are the same? + return sameCountry && sameAreaCode && sameNumber; + } + /** * No constructor for utilities classes */ diff --git a/src/org/mxchange/jphone/model/phonenumbers/landline/DialableLandLineNumber.java b/src/org/mxchange/jphone/model/phonenumbers/landline/DialableLandLineNumber.java index d24ffb2..013789e 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/landline/DialableLandLineNumber.java +++ b/src/org/mxchange/jphone/model/phonenumbers/landline/DialableLandLineNumber.java @@ -23,7 +23,7 @@ import org.mxchange.jphone.model.phonenumbers.DialableNumber; *

* @author Roland Häder */ -public interface DialableLandLineNumber extends DialableNumber { +public interface DialableLandLineNumber extends Comparable, DialableNumber { @Override boolean equals (final Object object); diff --git a/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumber.java b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumber.java index 71b825f..d7f601e 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumber.java +++ b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumber.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.model.phonenumbers.landline; +import java.text.MessageFormat; import java.util.Date; import java.util.Objects; import javax.persistence.Basic; @@ -33,6 +34,7 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.mxchange.jcoreutils.Comparables; import org.mxchange.jcountry.model.data.Country; import org.mxchange.jcountry.model.data.CountryData; @@ -45,8 +47,7 @@ import org.mxchange.jcountry.model.data.CountryData; @Table (name = "landline_numbers") @NamedQueries ( { - @NamedQuery (name = "AllLandLineNumbers", query = "SELECT p FROM landline_numbers AS p ORDER BY p.phoneId ASC"), - @NamedQuery (name = "SearchLandLineNumberId", query = "SELECT p FROM landline_numbers AS p WHERE p.phoneId = :landLineNumberId") + @NamedQuery (name = "AllLandLineNumbers", query = "SELECT p FROM landline_numbers AS p ORDER BY p.phoneId ASC") } ) @SuppressWarnings ("PersistenceUnitPresent") @@ -84,7 +85,7 @@ public class LandLineNumber implements DialableLandLineNumber { * Timestamp when this entry has been created */ @Temporal (TemporalType.TIMESTAMP) - @Column (name = "landline_entry_updated", updatable = false) + @Column (name = "landline_entry_updated", insertable = false) private Date phoneEntryUpdated; /** @@ -111,18 +112,70 @@ public class LandLineNumber implements DialableLandLineNumber { /** * Constructor with country instance, area code and number *

- * @param phoneCountry Country instance - * @param phoneAreaCode Phone area code - * @param phoneNumber Phone number + * @param landLineCountry An instance of a Country class + * @param landLineAreaCode Land-line area code + * @param landLineNumber Land-line number */ - public LandLineNumber (final Country phoneCountry, final Integer phoneAreaCode, final Long phoneNumber) { - // Call default constructor + public LandLineNumber (final Country landLineCountry, final Integer landLineAreaCode, final Long landLineNumber) { + // Invoke default constructor this(); + // Are all parameter set? + if (null == landLineAreaCode) { + // Throw NPE + throw new NullPointerException("landLineAreaCode is null"); //NOI18N + } else if (landLineAreaCode < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("landLineAreaCode={0} is not valid.", landLineAreaCode)); //NOI18N + } else if (null == landLineCountry) { + // Throw NPE + throw new NullPointerException("landLineCountry is null"); //NOI18N + } else if (null == landLineCountry.getCountryId()) { + // Throw NPE again + throw new NullPointerException("landLineCountry.countryId is null"); //NOI18N + } else if (landLineCountry.getCountryId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("landLineCountry.countryId={0} is not valid", landLineCountry.getCountryId())); //NOI18N + } else if (null == landLineNumber) { + // Throw NPE + throw new NullPointerException("landLineNumber is null"); //NOI18N + } else if (landLineNumber < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("landLineNumber={0} is not valid.", landLineNumber)); //NOI18N + } + // Set all values - this.phoneCountry = phoneCountry; - this.phoneAreaCode = phoneAreaCode; - this.phoneNumber = phoneNumber; + this.phoneCountry = landLineCountry; + this.phoneAreaCode = landLineAreaCode; + this.phoneNumber = landLineNumber; + } + + @Override + public int compareTo (final DialableLandLineNumber otherNumber) { + // Is the parameter given? + if (null == otherNumber) { + // Throw NPE + throw new NullPointerException("otherNumber is null"); //NOI18N + } else if (otherNumber.equals(this)) { + // Same object + return 0; + } + + // Init comparisons + final int[] comparators = { + // First country + this.getPhoneCountry().compareTo(otherNumber.getPhoneCountry()), + // Next area code + this.getPhoneAreaCode().compareTo(otherNumber.getPhoneAreaCode()), + // Last number + this.getPhoneNumber().compareTo(otherNumber.getPhoneNumber()) + }; + + // Check all values + final int comparison = Comparables.checkAll(comparators); + + // Return value + return comparison; } @Override @@ -133,15 +186,15 @@ public class LandLineNumber implements DialableLandLineNumber { return false; } - final DialableLandLineNumber other = (DialableLandLineNumber) object; + final DialableLandLineNumber landLineNumber = (DialableLandLineNumber) object; - if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { + if (!Objects.equals(this.getPhoneId(), landLineNumber.getPhoneId())) { return false; - } else if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { + } else if (!Objects.equals(this.getPhoneNumber(), landLineNumber.getPhoneNumber())) { return false; - } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) { + } else if (!Objects.equals(this.getPhoneAreaCode(), landLineNumber.getPhoneAreaCode())) { return false; - } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) { + } else if (!Objects.equals(this.getPhoneCountry(), landLineNumber.getPhoneCountry())) { return false; } diff --git a/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java index 2944be9..59c3fd7 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java +++ b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java @@ -17,6 +17,7 @@ package org.mxchange.jphone.model.phonenumbers.landline; import java.io.Serializable; +import java.util.Objects; /** * An utilities class for land-line numbers @@ -36,7 +37,7 @@ public class LandLineNumbers implements Serializable { * @param sourceNumber Source number object * @param targetNumber Target number object */ - public static void copyAll (final DialableLandLineNumber sourceNumber, final DialableLandLineNumber targetNumber) { + public static void copyLandLineNumber (final DialableLandLineNumber sourceNumber, final DialableLandLineNumber targetNumber) { // Validate instance if (null == sourceNumber) { // Throw NPE @@ -54,6 +55,31 @@ public class LandLineNumbers implements Serializable { targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); } + /** + * Checks if both are the same + *

+ * @param landLineNumber First land-line number + * @param otherNumber Second land-line number + *

+ * @return Whether both are the same + */ + public static boolean isSameLandLineNumber (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber otherNumber) { + // Test object equality first + if (Objects.equals(landLineNumber, otherNumber)) { + // Both the same object (null/null or same object) + return true; + } else if (((null == landLineNumber) && (otherNumber instanceof DialableLandLineNumber)) || ((null == otherNumber) && (landLineNumber instanceof DialableLandLineNumber))) { + // One is null the other not + return false; + } + // Now compare deeper + final boolean sameCountry = Objects.equals(landLineNumber.getPhoneCountry(), otherNumber.getPhoneCountry()); + final boolean sameAreaCode = Objects.equals(landLineNumber.getPhoneAreaCode(), otherNumber.getPhoneAreaCode()); + final boolean sameNumber = Objects.equals(landLineNumber.getPhoneNumber(), otherNumber.getPhoneNumber()); + // All are the same? + return sameCountry && sameAreaCode && sameNumber; + } + /** * No constructor for utilities classes */ diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobile/DialableMobileNumber.java b/src/org/mxchange/jphone/model/phonenumbers/mobile/DialableMobileNumber.java index b248932..2ea2177 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/mobile/DialableMobileNumber.java +++ b/src/org/mxchange/jphone/model/phonenumbers/mobile/DialableMobileNumber.java @@ -16,15 +16,16 @@ */ package org.mxchange.jphone.model.phonenumbers.mobile; +import java.io.Serializable; +import java.util.Date; import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; -import org.mxchange.jphone.model.phonenumbers.DialableNumber; /** * A POJO for dialable mobile numbers with carriers. *

* @author Roland Häder */ -public interface DialableMobileNumber extends DialableNumber { +public interface DialableMobileNumber extends Comparable, Serializable { /** * Getter for mobile provider @@ -40,6 +41,62 @@ public interface DialableMobileNumber extends DialableNumber { */ void setMobileProvider (final MobileProvider mobileProvider); + /** + * Getter for id number + *

+ * @return Id number + */ + Long getMobileId (); + + /** + * Setter for id number + *

+ * @param mobileId Id number + */ + void setMobileId (final Long mobileId); + + /** + * Getter for mobile number without prefix + *

+ * @return Mobile number without prefix + */ + Long getMobileNumber (); + + /** + * Setter for mobile number without prefix + *

+ * @param mobileNumber Mobile number without prefix + */ + void setMobileNumber (final Long mobileNumber); + + /** + * Getter for timestamp when this entry has been created + *

+ * @return Timestamp when this entry has been created + */ + Date getMobileEntryCreated (); + + /** + * Setter for timestamp when this entry has been created + *

+ * @param mobileEntryCreated Timestamp when this entry has been created + */ + void setMobileEntryCreated (final Date mobileEntryCreated); + + /** + * Getter for timestamp when this entry has been updated + *

+ * @return Timestamp when this entry has been updated + */ + Date getMobileEntryUpdated (); + + /** + * Setter for timestamp when this entry has been updated + *

+ * @param mobileEntryUpdated Timestamp when this entry has been updated + */ + void setMobileEntryUpdated (final Date mobileEntryUpdated); + @Override boolean equals (final Object object); diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumber.java b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumber.java index 45a7a45..b1ee3aa 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumber.java +++ b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumber.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.model.phonenumbers.mobile; +import java.text.MessageFormat; import java.util.Date; import java.util.Objects; import javax.persistence.Basic; @@ -33,12 +34,12 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import org.mxchange.jcountry.model.data.Country; +import org.mxchange.jcoreutils.Comparables; import org.mxchange.jphone.model.phonenumbers.mobileprovider.CellphoneProvider; import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; /** - * A POJO for dialable cellphone numbers + * A POJO for dialable mobile numbers *

* @author Roland Häder */ @@ -46,8 +47,7 @@ import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; @Table (name = "mobile_numbers") @NamedQueries ( { - @NamedQuery (name = "AllMobileNumbers", query = "SELECT c FROM mobile_numbers AS c ORDER BY c.phoneId ASC"), - @NamedQuery (name = "SearchMobileNumberId", query = "SELECT c FROM mobile_numbers AS c WHERE c.phoneId = :mobileNumberId") + @NamedQuery (name = "AllMobileNumbers", query = "SELECT m FROM mobile_numbers AS m ORDER BY m.mobileId ASC") } ) @SuppressWarnings ("PersistenceUnitPresent") @@ -59,27 +59,20 @@ public class MobileNumber implements DialableMobileNumber { @Transient private static final long serialVersionUID = 13_859_879_482_106L; - /** - * Connection to table "mobile_provider" (for dial prefix and more data) - */ - @JoinColumn (name = "mobile_provider_id", nullable = false) - @OneToOne (targetEntity = CellphoneProvider.class, cascade = CascadeType.REFRESH, optional = false) - private MobileProvider mobileProvider; - /** * Timestamp when this entry has been created */ @Basic (optional = false) @Temporal (TemporalType.TIMESTAMP) @Column (name = "mobile_entry_created", nullable = false, updatable = false) - private Date phoneEntryCreated; + private Date mobileEntryCreated; /** * Timestamp when this entry has been created */ @Temporal (TemporalType.TIMESTAMP) - @Column (name = "mobile_entry_updated", updatable = false) - private Date phoneEntryUpdated; + @Column (name = "mobile_entry_updated", insertable = false) + private Date mobileEntryUpdated; /** * Id number @@ -87,14 +80,21 @@ public class MobileNumber implements DialableMobileNumber { @Id @GeneratedValue (strategy = GenerationType.IDENTITY) @Column (name = "mobile_id", nullable = false, updatable = false) - private Long phoneId; + private Long mobileId; /** * Number without prefix to dial */ @Basic (optional = false) @Column (name = "mobile_number", nullable = false) - private Long phoneNumber; + private Long mobileNumber; + + /** + * Connection to table "mobile_provider" (for dial prefix and more data) + */ + @JoinColumn (name = "mobile_provider_id", nullable = false) + @OneToOne (targetEntity = CellphoneProvider.class, cascade = CascadeType.REFRESH, optional = false) + private MobileProvider mobileProvider; /** * Default constructor @@ -103,18 +103,62 @@ public class MobileNumber implements DialableMobileNumber { } /** - * Constructor with cellphone provider and number + * Constructor with mobile provider and number *

- * @param mobileProvider Mobile provider - * @param mobileNumber Mobile number + * @param mobileProvider An instance of a MobileProvider class + * @param mobileNumber Mobile calling number */ public MobileNumber (final MobileProvider mobileProvider, final Long mobileNumber) { - // Call default constructor + // Invoke default constructor this(); + // Are all parameter set? + if (null == mobileNumber) { + // Throw NPE + throw new NullPointerException("mobileNumber is null"); //NOI18N + } else if (mobileNumber < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("mobileNumber={0} is not valid.", mobileNumber)); //NOI18N + } else if (null == mobileProvider) { + // Throw NPE + throw new NullPointerException("mobileProvider is null"); //NOI18N + } else if (mobileProvider.getProviderId() == null) { + // Throw NPE again + throw new NullPointerException("mobileProvider.providerId is null"); //NOI18N + } else if (mobileProvider.getProviderId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("mobileProvider.providerId={0} is not valid", mobileProvider.getProviderId())); //NOI18N + } + // Set all values this.mobileProvider = mobileProvider; - this.phoneNumber = mobileNumber; + this.mobileNumber = mobileNumber; + } + + @Override + public int compareTo (final DialableMobileNumber otherNumber) { + // Is the parameter given? + if (null == otherNumber) { + // Throw NPE + throw new NullPointerException("otherNumber is null"); //NOI18N + } else if (otherNumber.equals(this)) { + // Same object + return 0; + } + + // Init comparisons + final int[] comparators = { + // First compare provider + this.getMobileProvider().compareTo(otherNumber.getMobileProvider()), + // Last number + this.getMobileNumber().compareTo(otherNumber.getMobileNumber()) + }; + + // Check all values + final int comparison = Comparables.checkAll(comparators); + + // Return value + return comparison; } @Override @@ -125,13 +169,13 @@ public class MobileNumber implements DialableMobileNumber { return false; } - final DialableMobileNumber other = (DialableMobileNumber) object; + final DialableMobileNumber dialableMobileNumber = (DialableMobileNumber) object; - if (!Objects.equals(this.getPhoneId(), other.getPhoneId())) { + if (!Objects.equals(this.getMobileId(), dialableMobileNumber.getMobileId())) { return false; - } else if (!Objects.equals(this.getMobileProvider(), other.getMobileProvider())) { + } else if (!Objects.equals(this.getMobileProvider(), dialableMobileNumber.getMobileProvider())) { return false; - } else if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) { + } else if (!Objects.equals(this.getMobileNumber(), dialableMobileNumber.getMobileNumber())) { return false; } @@ -139,90 +183,66 @@ public class MobileNumber implements DialableMobileNumber { } @Override - public MobileProvider getMobileProvider () { - return this.mobileProvider; - } - - @Override - public void setMobileProvider (final MobileProvider mobileProvider) { - this.mobileProvider = mobileProvider; - } - - @Override - @Deprecated - public Integer getPhoneAreaCode () { - throw new UnsupportedOperationException("Mobile numbers don't have area codes. Please fix your code."); //NOI18N - } - - @Override - @Deprecated - public void setPhoneAreaCode (final Integer phoneAreaCode) { - throw new UnsupportedOperationException("Mobile numbers don't have area codes. Please fix your code."); //NOI18N - } - - @Override - @Deprecated - public Country getPhoneCountry () { - throw new UnsupportedOperationException("The country code is provided by MobileProvider."); //To change body of generated methods, choose Tools | Templates. + @SuppressWarnings ("ReturnOfDateField") + public Date getMobileEntryCreated () { + return this.mobileEntryCreated; } @Override - @Deprecated - public void setPhoneCountry (final Country country) { - throw new UnsupportedOperationException("The country code is provided by MobileProvider."); //To change body of generated methods, choose Tools | Templates. + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setMobileEntryCreated (final Date mobileEntryCreated) { + this.mobileEntryCreated = mobileEntryCreated; } @Override @SuppressWarnings ("ReturnOfDateField") - public Date getPhoneEntryCreated () { - return this.phoneEntryCreated; + public Date getMobileEntryUpdated () { + return this.mobileEntryUpdated; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setPhoneEntryCreated (final Date phoneEntryCreated) { - this.phoneEntryCreated = phoneEntryCreated; + public void setMobileEntryUpdated (final Date mobileEntryUpdated) { + this.mobileEntryUpdated = mobileEntryUpdated; } @Override - @SuppressWarnings ("ReturnOfDateField") - public Date getPhoneEntryUpdated () { - return this.phoneEntryUpdated; + public Long getMobileId () { + return this.mobileId; } @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setPhoneEntryUpdated (final Date phoneEntryUpdated) { - this.phoneEntryUpdated = phoneEntryUpdated; + public void setMobileId (final Long mobileId) { + this.mobileId = mobileId; } @Override - public Long getPhoneId () { - return this.phoneId; + public Long getMobileNumber () { + return this.mobileNumber; } @Override - public void setPhoneId (final Long phoneId) { - this.phoneId = phoneId; + public void setMobileNumber (final Long mobileNumber) { + this.mobileNumber = mobileNumber; } @Override - public Long getPhoneNumber () { - return this.phoneNumber; + public MobileProvider getMobileProvider () { + return this.mobileProvider; } @Override - public void setPhoneNumber (final Long phoneNumber) { - this.phoneNumber = phoneNumber; + public void setMobileProvider (final MobileProvider mobileProvider) { + this.mobileProvider = mobileProvider; } @Override public int hashCode () { int hash = 5; - hash = 97 * hash + Objects.hashCode(this.getPhoneId()); + hash = 97 * hash + Objects.hashCode(this.getMobileId()); hash = 97 * hash + Objects.hashCode(this.getMobileProvider()); - hash = 97 * hash + Objects.hashCode(this.getPhoneNumber()); + hash = 97 * hash + Objects.hashCode(this.getMobileNumber()); return hash; } diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java index 1dab654..37764bb 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java +++ b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java @@ -17,6 +17,7 @@ package org.mxchange.jphone.model.phonenumbers.mobile; import java.io.Serializable; +import java.util.Objects; /** * An utilities class for mobile numbers @@ -36,7 +37,7 @@ public class MobileNumbers implements Serializable { * @param sourceNumber Source number object * @param targetNumber Target number object */ - public static void copyAll (final DialableMobileNumber sourceNumber, final DialableMobileNumber targetNumber) { + public static void copyMobileNumber (final DialableMobileNumber sourceNumber, final DialableMobileNumber targetNumber) { // Validate instance if (null == sourceNumber) { // Throw NPE @@ -48,9 +49,33 @@ public class MobileNumbers implements Serializable { // Copy all fields targetNumber.setMobileProvider(sourceNumber.getMobileProvider()); - targetNumber.setPhoneEntryCreated(sourceNumber.getPhoneEntryCreated()); - targetNumber.setPhoneId(sourceNumber.getPhoneId()); - targetNumber.setPhoneNumber(sourceNumber.getPhoneNumber()); + targetNumber.setMobileEntryCreated(sourceNumber.getMobileEntryCreated()); + targetNumber.setMobileId(sourceNumber.getMobileId()); + targetNumber.setMobileNumber(sourceNumber.getMobileNumber()); + } + + /** + * Checks if both are the same + *

+ * @param mobileNumber Mobile number 1 + * @param otherNumber Mobile number 2 + *

+ * @return Whether both are the same number + */ + public static boolean isSameMobileNumber (final DialableMobileNumber mobileNumber, final DialableMobileNumber otherNumber) { + // Test object equality first + if (Objects.equals(mobileNumber, otherNumber)) { + // Both the same object (null/null or same object) + return true; + } else if (((null == mobileNumber) && (otherNumber instanceof DialableMobileNumber)) || ((null == otherNumber) && (mobileNumber instanceof DialableMobileNumber))) { + // One is null the other not + return false; + } + // Now compare deeper + final boolean sameProvider = Objects.equals(mobileNumber.getMobileProvider(), otherNumber.getMobileProvider()); + final boolean sameNumber = Objects.equals(mobileNumber.getMobileNumber(), otherNumber.getMobileNumber()); + // All are the same? + return sameProvider && sameNumber; } /** diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/CellphoneProvider.java b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/CellphoneProvider.java index cd8f6cb..5b2c976 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/CellphoneProvider.java +++ b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/CellphoneProvider.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.model.phonenumbers.mobileprovider; +import java.text.MessageFormat; import java.util.Date; import java.util.Objects; import javax.persistence.Basic; @@ -33,11 +34,13 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.apache.commons.lang3.StringUtils; +import org.mxchange.jcoreutils.Comparables; import org.mxchange.jcountry.model.data.Country; import org.mxchange.jcountry.model.data.CountryData; /** - * A POJO for cellphone providers + * A POJO for mobile providers *

* @author Roland Häder */ @@ -109,13 +112,43 @@ public class CellphoneProvider implements MobileProvider { *

* @param providerDialPrefix Dial prefix * @param providerName Name - * @param providerCountry Country + * @param providerCountry An instance of a Country class * @param providerMailPattern Pattern for email */ public CellphoneProvider (final Long providerDialPrefix, final String providerName, final Country providerCountry, final String providerMailPattern) { - // Call default constructor + // Invoke default constructor this(); + // Are all parameter set? + if (null == providerDialPrefix) { + // Throw NPE + throw new NullPointerException("providerDialPrefix is null"); //NOI18N + } else if (providerDialPrefix < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("providerDialPrefix={0} is not valid.", providerDialPrefix)); //NOI18N + } else if (null == providerName) { + // Throw NPE + throw new NullPointerException("providerName is null"); //NOI18N + } else if (providerName.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("providerName is empty"); //NOI18N + } else if (null == providerCountry) { + // Throw NPE + throw new NullPointerException("providerCountry is null"); //NOI18N + } else if (null == providerCountry.getCountryId()) { + // Throw NPE again + throw new NullPointerException("providerCountry.countryId is null"); //NOI18N + } else if (providerCountry.getCountryId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("providerCountry.countryId={0} is not valid", providerCountry.getCountryId())); //NOI18N + } else if (null == providerMailPattern) { + // Throw NPE + throw new NullPointerException("providerMailPattern is null"); //NOI18N + } else if (providerMailPattern.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("providerMailPattern is empty"); //NOI18N + } + // Set all values this.providerDialPrefix = providerDialPrefix; this.providerName = providerName; @@ -123,6 +156,34 @@ public class CellphoneProvider implements MobileProvider { this.providerMailPattern = providerMailPattern; } + @Override + public int compareTo (final MobileProvider otherProvider) { + // Is the parameter given? + if (null == otherProvider) { + // Throw NPE + throw new NullPointerException("otherProvider is null"); //NOI18N + } else if (otherProvider.equals(this)) { + // Same object + return 0; + } + + // Init comparisons + final int[] comparators = { + // First provider + this.getProviderCountry().compareTo(otherProvider.getProviderCountry()), + // Next is name + StringUtils.compare(this.getProviderName(), otherProvider.getProviderName()), + // Last is dial prefix + this.getProviderDialPrefix().compareTo(otherProvider.getProviderDialPrefix()) + }; + + // Check all values + final int comparison = Comparables.checkAll(comparators); + + // Return value + return comparison; + } + @Override public boolean equals (final Object object) { if (null == object) { @@ -131,28 +192,19 @@ public class CellphoneProvider implements MobileProvider { return false; } - final MobileProvider other = (MobileProvider) object; + final MobileProvider mobileProvider = (MobileProvider) object; - if (!Objects.equals(this.getProviderDialPrefix(), other.getProviderDialPrefix())) { + if (!Objects.equals(this.getProviderDialPrefix(), mobileProvider.getProviderDialPrefix())) { return false; - } else if (!Objects.equals(this.getProviderName(), other.getProviderName())) { + } else if (!Objects.equals(this.getProviderName(), mobileProvider.getProviderName())) { return false; - } else if (!Objects.equals(this.getProviderCountry(), other.getProviderCountry())) { + } else if (!Objects.equals(this.getProviderCountry(), mobileProvider.getProviderCountry())) { return false; } return true; } - @Override - public int hashCode () { - int hash = 7; - hash = 19 * hash + Objects.hashCode(this.getProviderDialPrefix()); - hash = 19 * hash + Objects.hashCode(this.getProviderName()); - hash = 19 * hash + Objects.hashCode(this.getProviderCountry()); - return hash; - } - @Override public Country getProviderCountry () { return this.providerCountry; @@ -195,6 +247,16 @@ public class CellphoneProvider implements MobileProvider { this.providerId = providerId; } + @Override + public String getProviderMailPattern () { + return this.providerMailPattern; + } + + @Override + public void setProviderMailPattern (final String providerMailPattern) { + this.providerMailPattern = providerMailPattern; + } + @Override public String getProviderName () { return this.providerName; @@ -206,13 +268,14 @@ public class CellphoneProvider implements MobileProvider { } @Override - public String getProviderMailPattern () { - return this.providerMailPattern; - } + public int hashCode () { + int hash = 7; - @Override - public void setProviderMailPattern (final String providerMailPattern) { - this.providerMailPattern = providerMailPattern; + hash = 19 * hash + Objects.hashCode(this.getProviderDialPrefix()); + hash = 19 * hash + Objects.hashCode(this.getProviderName()); + hash = 19 * hash + Objects.hashCode(this.getProviderCountry()); + + return hash; } } diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProvider.java b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProvider.java index e96371f..f7c7127 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProvider.java +++ b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProvider.java @@ -25,7 +25,7 @@ import org.mxchange.jcountry.model.data.Country; *

* @author Roland Häder */ -public interface MobileProvider extends Serializable { +public interface MobileProvider extends Comparable, Serializable { /** * Getter for id number diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java index 76f66aa..5c645af 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java +++ b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java @@ -38,7 +38,7 @@ public class MobileProviders implements Serializable { * @param sourceMobileProvider Source mobile provider * @param targetMobileProvider Target mobile provider */ - public static void copyAll (final MobileProvider sourceMobileProvider, final MobileProvider targetMobileProvider) { + public static void copyMobileProvider (final MobileProvider sourceMobileProvider, final MobileProvider targetMobileProvider) { // Parameter should not be null if (null == sourceMobileProvider) { // Throw NPE diff --git a/src/org/mxchange/jphone/utils/PhoneUtils.java b/src/org/mxchange/jphone/utils/PhoneUtils.java deleted file mode 100644 index 1e28f22..0000000 --- a/src/org/mxchange/jphone/utils/PhoneUtils.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2016 - 2020 Free Software Foundation - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.utils; - -import java.io.Serializable; -import java.util.Objects; -import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; - -/** - * - * @author Roland Häder - */ -public class PhoneUtils implements Serializable { - - /** - * Serial number - */ - private static final long serialVersionUID = 183_598_328_176_450L; - - /** - * Checks if both are the same - *

- * @param faxNumber First fax number - * @param otherNumber Second fax number - *

- * @return Whether both are the same - */ - public static boolean isSameFaxNumber (final DialableFaxNumber faxNumber, DialableFaxNumber otherNumber) { - // Test object equality first - if (Objects.equals(faxNumber, otherNumber)) { - // Both the same object (null/null or same object) - return true; - } else if (((null == faxNumber) && (otherNumber instanceof DialableFaxNumber)) || ((null == otherNumber) && (faxNumber instanceof DialableFaxNumber))) { - // One is null the other not - return false; - } - - // Now compare deeper - @SuppressWarnings ("null") - boolean sameCountry = Objects.equals(faxNumber.getPhoneCountry(), otherNumber.getPhoneCountry()); - boolean sameAreaCode = Objects.equals(faxNumber.getPhoneAreaCode(), otherNumber.getPhoneAreaCode()); - boolean sameNumber = Objects.equals(faxNumber.getPhoneNumber(), otherNumber.getPhoneNumber()); - - // All are the same? - return (sameCountry && sameAreaCode && sameNumber); - } - - /** - * Checks if both are the same - *

- * @param landLineNumber First land-line number - * @param otherNumber Second land-line number - *

- * @return Whether both are the same - */ - public static boolean isSameLandLineNumber (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber otherNumber) { - // Test object equality first - if (Objects.equals(landLineNumber, otherNumber)) { - // Both the same object (null/null or same object) - return true; - } else if (((null == landLineNumber) && (otherNumber instanceof DialableLandLineNumber)) || ((null == otherNumber) && (landLineNumber instanceof DialableLandLineNumber))) { - // One is null the other not - return false; - } - - // Now compare deeper - @SuppressWarnings ("null") - boolean sameCountry = Objects.equals(landLineNumber.getPhoneCountry(), otherNumber.getPhoneCountry()); - boolean sameAreaCode = Objects.equals(landLineNumber.getPhoneAreaCode(), otherNumber.getPhoneAreaCode()); - boolean sameNumber = Objects.equals(landLineNumber.getPhoneNumber(), otherNumber.getPhoneNumber()); - - // All are the same? - return (sameCountry && sameAreaCode && sameNumber); - } - - /** - * Checks if both are the same - *

- * @param mobileNumber Mobile number 1 - * @param otherNumber Mobile number 2 - *

- * @return Whether both are the same number - */ - public static boolean isSameMobileNumber (final DialableMobileNumber mobileNumber, final DialableMobileNumber otherNumber) { - // Test object equality first - if (Objects.equals(mobileNumber, otherNumber)) { - // Both the same object (null/null or same object) - return true; - } else if (((null == mobileNumber) && (otherNumber instanceof DialableMobileNumber)) || ((null == otherNumber) && (mobileNumber instanceof DialableMobileNumber))) { - // One is null the other not - return false; - } - - // Now compare deeper - @SuppressWarnings ("null") - boolean sameProvider = Objects.equals(mobileNumber.getMobileProvider(), otherNumber.getMobileProvider()); - boolean sameNumber = Objects.equals(mobileNumber.getPhoneNumber(), otherNumber.getPhoneNumber()); - - // All are the same? - return (sameProvider && sameNumber); - } - - /** - * Private constructor for utility classes - */ - private PhoneUtils () { - } - -} -- 2.39.5