/*
- * Copyright (C) 2016 - 2022 Free Software Foundation
+ * 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.landline.deleted;
+import java.text.MessageFormat;
import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
/**
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-public class AdminLandLineNumberDeletedEvent implements AdminDeletedLandLineNumberEvent {
+public class AdminLandLineNumberDeletedEvent implements ObservableAdminLandLineNumberDeletedEvent {
/**
* Serial number
* @param deletedLandLineNumber Deleted land-line number
*/
public AdminLandLineNumberDeletedEvent (final DialableLandLineNumber deletedLandLineNumber) {
+ // Check parameter
+ if (null == deletedLandLineNumber) {
+ // Throw NPE
+ throw new NullPointerException("Parameter 'deletedLandLineNumber' is null"); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneId() == null) {
+ // Throw it again
+ throw new NullPointerException("deletedLandLineNumber.phoneId is null"); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("deletedLandLineNumber.phoneId={0} is invalid", deletedLandLineNumber.getPhoneId())); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneAreaCode() == null) {
+ // Throw it again
+ throw new NullPointerException("deletedLandLineNumber.phoneAreaCode is null"); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneAreaCode() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("deletedLandLineNumber.phoneAreaCode={0} is invalid", deletedLandLineNumber.getPhoneAreaCode())); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneNumber() == null) {
+ // Throw it again
+ throw new NullPointerException("deletedLandLineNumber.phoneNumber is null"); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneNumber() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("deletedLandLineNumber.phoneNumber={0} is invalid", deletedLandLineNumber.getPhoneNumber())); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneCountry() == null) {
+ // Throw it again
+ throw new NullPointerException("deletedLandLineNumber.phoneCountry is null"); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneCountry().getCountryId() == null) {
+ // Throw it again
+ throw new NullPointerException("deletedLandLineNumber.phoneCountry.countryId is null"); //NOI18M
+ } else if (deletedLandLineNumber.getPhoneCountry().getCountryId() < 1) {
+ // Throw it again
+ throw new NullPointerException(MessageFormat.format("deletedLandLineNumber.phoneCountry.countryId={0} is invalid", deletedLandLineNumber.getPhoneCountry().getCountryId())); //NOI18M
+ }
+
// Set it here
this.deletedLandLineNumber = deletedLandLineNumber;
}