]> git.mxchange.org Git - jphone-core.git/blobdiff - src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java
Updated copyright year
[jphone-core.git] / src / org / mxchange / jphone / events / fax / created / CreatedFaxNumberEvent.java
index ae35a512b20af9dd9c85c37e3e83ff74f2e8e6d4..cab631ed424a9037d6ec182d1cb7cf974a106403 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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 {
 
@@ -42,6 +43,40 @@ 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;
        }