*/
package org.mxchange.jcontacts.model.contact;
+import java.text.MessageFormat;
import java.util.Date;
import java.util.Objects;
import javax.persistence.Basic;
import org.mxchange.jcontacts.model.contact.title.PersonalTitle;
import org.mxchange.jcoreutils.comparable.ComparableUtils;
import org.mxchange.jcoreutils.number.SafeNumberUtils;
-import org.mxchange.jcountry.model.utils.CountryUtils;
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;
* @param contactPersonalTitle Personal title
* @param contactFirstName First name
* @param contactFamilyName Family name
+ * @param contactCountry Country instance
*/
- public UserContact (final PersonalTitle contactPersonalTitle, final String contactFirstName, final String contactFamilyName) {
+ public UserContact (final PersonalTitle contactPersonalTitle, final String contactFirstName, final String contactFamilyName, final Country contactCountry) {
// Invoke default constructor
this();
} else if (contactFamilyName.isEmpty()) {
// Throw IAE
throw new IllegalArgumentException("contactFamilyName is empty"); //NOI18N
+ } else if (null == contactCountry) {
+ // Throw NPE
+ throw new NullPointerException("contactCountry is null"); //NOI18N
+ } else if (contactCountry.getCountryId() == null) {
+ // Throw it again
+ throw new NullPointerException("contactCountry.countryId is null"); //NOI18N
+ } else if (contactCountry.getCountryId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("contactCountry.countryId={0} is not valid", contactCountry.getCountryId())); //NOI18N
}
// Set all
this.contactPersonalTitle = contactPersonalTitle;
this.contactFirstName = contactFirstName;
this.contactFamilyName = contactFamilyName;
+ this.contactCountry = contactCountry;
}
@Override