/*
- * Copyright (C) 2017 Roland Haeder<roland@mxchange.org>
+ * Copyright (C) 2017 - 2024 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
*/
package org.mxchange.jphone.events.fax.created;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import java.text.MessageFormat;
+import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
/**
* An event being fired when a fax number instance has been successfully
* created.
* <p>
- * @author Roland Haeder<roland@mxchange.org>
+ * @author Roland Hรคder<roland@mxchange.org>
*/
public class CreatedFaxNumberEvent implements ObservableCreatedFaxNumberEvent {
* @param faxNumber Fax number instance
*/
public CreatedFaxNumberEvent (final DialableFaxNumber faxNumber) {
+ // Check parameter
+ if (null == faxNumber) {
+ // Throw NPE
+ throw new NullPointerException("Parameter 'faxNumber' is null"); //NOI18M
+ } else if (faxNumber.getPhoneId() == null) {
+ // Throw it again
+ throw new NullPointerException("faxNumber.phoneId is null"); //NOI18M
+ } else if (faxNumber.getPhoneId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is invalid", faxNumber.getPhoneId())); //NOI18M
+ } else if (faxNumber.getPhoneAreaCode() == null) {
+ // Throw it again
+ throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18M
+ } else if (faxNumber.getPhoneAreaCode() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is invalid", faxNumber.getPhoneAreaCode())); //NOI18M
+ } else if (faxNumber.getPhoneNumber() == null) {
+ // Throw it again
+ throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18M
+ } else if (faxNumber.getPhoneNumber() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is invalid", faxNumber.getPhoneNumber())); //NOI18M
+ } else if (faxNumber.getPhoneCountry() == null) {
+ // Throw it again
+ throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18M
+ } else if (faxNumber.getPhoneCountry().getCountryId() == null) {
+ // Throw it again
+ throw new NullPointerException("faxNumber.phoneCountry.countryId is null"); //NOI18M
+ } else if (faxNumber.getPhoneCountry().getCountryId() < 1) {
+ // Throw it again
+ throw new NullPointerException(MessageFormat.format("faxNumber.phoneCountry.countryId={0} is invalid", faxNumber.getPhoneCountry().getCountryId())); //NOI18M
+ }
+
+ // Set it here
this.faxNumber = faxNumber;
}