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