X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Fjphone%2Fevents%2Flandline%2Fupdated%2FAdminLandLineNumberUpdatedEvent.java;h=0a325d9a2fb088549c056ef21e5d6f66b0b54b0b;hb=refs%2Fheads%2Fmaster;hp=0b1a9b6fd104fc9be7c0010ad60555501203b84a;hpb=7b030151b0001ec0712270464795fd62687cfc0b;p=jphone-core.git diff --git a/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java index 0b1a9b6..0a325d9 100644 --- a/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java +++ b/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 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 @@ -16,14 +16,15 @@ */ package org.mxchange.jphone.events.landline.updated; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import java.text.MessageFormat; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** * An event when a mobile number has been updated *

* @author Roland Häder */ -public class AdminLandLineNumberUpdatedEvent implements AdminUpdatedLandLineNumberEvent { +public class AdminLandLineNumberUpdatedEvent implements ObservableAdminLandLineNumberUpdatedEvent { /** * Serial number @@ -41,6 +42,39 @@ public class AdminLandLineNumberUpdatedEvent implements AdminUpdatedLandLineNumb * @param updatedLandLineNumber Updated mobile number */ public AdminLandLineNumberUpdatedEvent (final DialableLandLineNumber updatedLandLineNumber) { + // Check parameter + if (null == updatedLandLineNumber) { + // Throw NPE + throw new NullPointerException("Parameter 'updatedLandLineNumber' is null"); //NOI18M + } else if (updatedLandLineNumber.getPhoneId() == null) { + // Throw it again + throw new NullPointerException("updatedLandLineNumber.phoneId is null"); //NOI18M + } else if (updatedLandLineNumber.getPhoneId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("updatedLandLineNumber.phoneId={0} is invalid", updatedLandLineNumber.getPhoneId())); //NOI18M + } else if (updatedLandLineNumber.getPhoneAreaCode() == null) { + // Throw it again + throw new NullPointerException("updatedLandLineNumber.phoneAreaCode is null"); //NOI18M + } else if (updatedLandLineNumber.getPhoneAreaCode() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("updatedLandLineNumber.phoneAreaCode={0} is invalid", updatedLandLineNumber.getPhoneAreaCode())); //NOI18M + } else if (updatedLandLineNumber.getPhoneNumber() == null) { + // Throw it again + throw new NullPointerException("updatedLandLineNumber.phoneNumber is null"); //NOI18M + } else if (updatedLandLineNumber.getPhoneNumber() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("updatedLandLineNumber.phoneNumber={0} is invalid", updatedLandLineNumber.getPhoneNumber())); //NOI18M + } else if (updatedLandLineNumber.getPhoneCountry() == null) { + // Throw it again + throw new NullPointerException("updatedLandLineNumber.phoneCountry is null"); //NOI18M + } else if (updatedLandLineNumber.getPhoneCountry().getCountryId() == null) { + // Throw it again + throw new NullPointerException("updatedLandLineNumber.phoneCountry.countryId is null"); //NOI18M + } else if (updatedLandLineNumber.getPhoneCountry().getCountryId() < 1) { + // Throw it again + throw new NullPointerException(MessageFormat.format("updatedLandLineNumber.phoneCountry.countryId={0} is invalid", updatedLandLineNumber.getPhoneCountry().getCountryId())); //NOI18M + } + // Set it here this.updatedLandLineNumber = updatedLandLineNumber; }