2 * Copyright (C) 2016 - 2024 Free Software Foundation
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jphone.events.fax.updated;
19 import java.text.MessageFormat;
20 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
23 * An event when a fax number has been updated
25 * @author Roland Häder<roland@mxchange.org>
27 public class AdminFaxNumberUpdatedEvent implements ObservableAdminFaxNumberUpdatedEvent {
32 private static final long serialVersionUID = 18_521_758_718_691_064L;
35 * Updated fax provider instance
37 private final DialableFaxNumber updatedFaxNumber;
40 * Constructor with updated fax number
42 * @param updatedFaxNumber Updated fax number
44 public AdminFaxNumberUpdatedEvent (final DialableFaxNumber updatedFaxNumber) {
46 if (null == updatedFaxNumber) {
48 throw new NullPointerException("Parameter 'updatedFaxNumber' is null"); //NOI18M
49 } else if (updatedFaxNumber.getPhoneId() == null) {
51 throw new NullPointerException("updatedFaxNumber.phoneId is null"); //NOI18M
52 } else if (updatedFaxNumber.getPhoneId() < 1) {
54 throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneId={0} is invalid", updatedFaxNumber.getPhoneId())); //NOI18M
55 } else if (updatedFaxNumber.getPhoneAreaCode() == null) {
57 throw new NullPointerException("updatedFaxNumber.phoneAreaCode is null"); //NOI18M
58 } else if (updatedFaxNumber.getPhoneAreaCode() < 1) {
60 throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneAreaCode={0} is invalid", updatedFaxNumber.getPhoneAreaCode())); //NOI18M
61 } else if (updatedFaxNumber.getPhoneNumber() == null) {
63 throw new NullPointerException("updatedFaxNumber.phoneNumber is null"); //NOI18M
64 } else if (updatedFaxNumber.getPhoneNumber() < 1) {
66 throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneNumber={0} is invalid", updatedFaxNumber.getPhoneNumber())); //NOI18M
67 } else if (updatedFaxNumber.getPhoneCountry() == null) {
69 throw new NullPointerException("updatedFaxNumber.phoneCountry is null"); //NOI18M
70 } else if (updatedFaxNumber.getPhoneCountry().getCountryId() == null) {
72 throw new NullPointerException("updatedFaxNumber.phoneCountry.countryId is null"); //NOI18M
73 } else if (updatedFaxNumber.getPhoneCountry().getCountryId() < 1) {
75 throw new NullPointerException(MessageFormat.format("updatedFaxNumber.phoneCountry.countryId={0} is invalid", updatedFaxNumber.getPhoneCountry().getCountryId())); //NOI18M
79 this.updatedFaxNumber = updatedFaxNumber;
83 public DialableFaxNumber getUpdatedFaxNumber () {
84 return this.updatedFaxNumber;