2 * Copyright (C) 2017 - 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.created;
19 import java.text.MessageFormat;
20 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
23 * An event being fired when a fax number instance has been successfully
26 * @author Roland Häder<roland@mxchange.org>
28 public class CreatedFaxNumberEvent implements ObservableCreatedFaxNumberEvent {
33 private static final long serialVersionUID = 50_498_269_827_581L;
38 private DialableFaxNumber faxNumber;
41 * Constructor with fax number instance
43 * @param faxNumber Fax number instance
45 public CreatedFaxNumberEvent (final DialableFaxNumber faxNumber) {
47 if (null == faxNumber) {
49 throw new NullPointerException("Parameter 'faxNumber' is null"); //NOI18M
50 } else if (faxNumber.getPhoneId() == null) {
52 throw new NullPointerException("faxNumber.phoneId is null"); //NOI18M
53 } else if (faxNumber.getPhoneId() < 1) {
55 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is invalid", faxNumber.getPhoneId())); //NOI18M
56 } else if (faxNumber.getPhoneAreaCode() == null) {
58 throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18M
59 } else if (faxNumber.getPhoneAreaCode() < 1) {
61 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is invalid", faxNumber.getPhoneAreaCode())); //NOI18M
62 } else if (faxNumber.getPhoneNumber() == null) {
64 throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18M
65 } else if (faxNumber.getPhoneNumber() < 1) {
67 throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is invalid", faxNumber.getPhoneNumber())); //NOI18M
68 } else if (faxNumber.getPhoneCountry() == null) {
70 throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18M
71 } else if (faxNumber.getPhoneCountry().getCountryId() == null) {
73 throw new NullPointerException("faxNumber.phoneCountry.countryId is null"); //NOI18M
74 } else if (faxNumber.getPhoneCountry().getCountryId() < 1) {
76 throw new NullPointerException(MessageFormat.format("faxNumber.phoneCountry.countryId={0} is invalid", faxNumber.getPhoneCountry().getCountryId())); //NOI18M
80 this.faxNumber = faxNumber;
84 public DialableFaxNumber getFaxNumber () {
85 return this.faxNumber;
89 public void setFaxNumber (final DialableFaxNumber faxNumber) {
90 this.faxNumber = faxNumber;