/*
- * Copyright (C) 2016, 2017 Roland Häder
+ * Copyright (C) 2016 - 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.updated;
+import java.text.MessageFormat;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
/**
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-public class AdminFaxNumberUpdatedEvent implements AdminUpdatedFaxNumberEvent {
+public class AdminFaxNumberUpdatedEvent implements ObservableAdminFaxNumberUpdatedEvent {
/**
* Serial number
* @param updatedFaxNumber Updated fax number
*/
public AdminFaxNumberUpdatedEvent (final DialableFaxNumber updatedFaxNumber) {
+ // Check parameter
+ if (null == updatedFaxNumber) {
+ // Throw NPE
+ throw new NullPointerException("Parameter 'updatedFaxNumber' is null"); //NOI18M
+ } else if (updatedFaxNumber.getPhoneId() == null) {
+ // Throw it again
+ throw new NullPointerException("updatedFaxNumber.phoneId is null"); //NOI18M
+ } else if (updatedFaxNumber.getPhoneId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneId={0} is invalid", updatedFaxNumber.getPhoneId())); //NOI18M
+ } else if (updatedFaxNumber.getPhoneAreaCode() == null) {
+ // Throw it again
+ throw new NullPointerException("updatedFaxNumber.phoneAreaCode is null"); //NOI18M
+ } else if (updatedFaxNumber.getPhoneAreaCode() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneAreaCode={0} is invalid", updatedFaxNumber.getPhoneAreaCode())); //NOI18M
+ } else if (updatedFaxNumber.getPhoneNumber() == null) {
+ // Throw it again
+ throw new NullPointerException("updatedFaxNumber.phoneNumber is null"); //NOI18M
+ } else if (updatedFaxNumber.getPhoneNumber() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneNumber={0} is invalid", updatedFaxNumber.getPhoneNumber())); //NOI18M
+ } else if (updatedFaxNumber.getPhoneCountry() == null) {
+ // Throw it again
+ throw new NullPointerException("updatedFaxNumber.phoneCountry is null"); //NOI18M
+ } else if (updatedFaxNumber.getPhoneCountry().getCountryId() == null) {
+ // Throw it again
+ throw new NullPointerException("updatedFaxNumber.phoneCountry.countryId is null"); //NOI18M
+ } else if (updatedFaxNumber.getPhoneCountry().getCountryId() < 1) {
+ // Throw it again
+ throw new NullPointerException(MessageFormat.format("updatedFaxNumber.phoneCountry.countryId={0} is invalid", updatedFaxNumber.getPhoneCountry().getCountryId())); //NOI18M
+ }
+
// Set it here
this.updatedFaxNumber = updatedFaxNumber;
}