From: Roland Häder Date: Sun, 22 Jan 2023 06:48:35 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1a0f1cd8a1ff113dd24954bf5903a70f5ec62225;p=jphone-core.git Continued: - added checks for parameters - renamed event interfaces with prefx "Observable" --- diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index fa82023..f8e0c8e 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java b/src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java index 706b1cc..b43edf9 100644 --- a/src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java +++ b/src/org/mxchange/jphone/events/fax/created/CreatedFaxNumberEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.fax.created; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** @@ -42,6 +43,40 @@ public class CreatedFaxNumberEvent implements ObservableCreatedFaxNumberEvent { * @param faxNumber Fax number instance */ public CreatedFaxNumberEvent (final DialableFaxNumber faxNumber) { + // Check parameter + if (null == faxNumber) { + // Throw NPE + throw new NullPointerException("Parameter 'faxNumber' is null"); //NOI18M + } else if (faxNumber.getPhoneId() == null) { + // Throw it again + throw new NullPointerException("faxNumber.phoneId is null"); //NOI18M + } else if (faxNumber.getPhoneId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is invalid", faxNumber.getPhoneId())); //NOI18M + } else if (faxNumber.getPhoneAreaCode() == null) { + // Throw it again + throw new NullPointerException("faxNumber.phoneAreaCode is null"); //NOI18M + } else if (faxNumber.getPhoneAreaCode() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneAreaCode={0} is invalid", faxNumber.getPhoneAreaCode())); //NOI18M + } else if (faxNumber.getPhoneNumber() == null) { + // Throw it again + throw new NullPointerException("faxNumber.phoneNumber is null"); //NOI18M + } else if (faxNumber.getPhoneNumber() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneNumber={0} is invalid", faxNumber.getPhoneNumber())); //NOI18M + } else if (faxNumber.getPhoneCountry() == null) { + // Throw it again + throw new NullPointerException("faxNumber.phoneCountry is null"); //NOI18M + } else if (faxNumber.getPhoneCountry().getCountryId() == null) { + // Throw it again + throw new NullPointerException("faxNumber.phoneCountry.countryId is null"); //NOI18M + } else if (faxNumber.getPhoneCountry().getCountryId() < 1) { + // Throw it again + throw new NullPointerException(MessageFormat.format("faxNumber.phoneCountry.countryId={0} is invalid", faxNumber.getPhoneCountry().getCountryId())); //NOI18M + } + + // Set it here this.faxNumber = faxNumber; } diff --git a/src/org/mxchange/jphone/events/fax/deleted/AdminDeletedFaxNumberEvent.java b/src/org/mxchange/jphone/events/fax/deleted/AdminDeletedFaxNumberEvent.java deleted file mode 100644 index d27752d..0000000 --- a/src/org/mxchange/jphone/events/fax/deleted/AdminDeletedFaxNumberEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.fax.deleted; - -import java.io.Serializable; -import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; - -/** - * An interface for an event when a fax number has been deleted - *

- * @author Roland Häder - */ -public interface AdminDeletedFaxNumberEvent extends Serializable { - - /** - * Getter for deleted fax numbers - *

- * @return Deleted fax numbers - */ - DialableFaxNumber getDeletedFaxNumber (); - -} diff --git a/src/org/mxchange/jphone/events/fax/deleted/AdminFaxNumberDeletedEvent.java b/src/org/mxchange/jphone/events/fax/deleted/AdminFaxNumberDeletedEvent.java index fea6a59..56f4314 100644 --- a/src/org/mxchange/jphone/events/fax/deleted/AdminFaxNumberDeletedEvent.java +++ b/src/org/mxchange/jphone/events/fax/deleted/AdminFaxNumberDeletedEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.fax.deleted; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** @@ -23,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; *

* @author Roland Häder */ -public class AdminFaxNumberDeletedEvent implements AdminDeletedFaxNumberEvent { +public class AdminFaxNumberDeletedEvent implements ObservableAdminFaxNumberDeletedEvent { /** * Serial number @@ -41,6 +42,39 @@ public class AdminFaxNumberDeletedEvent implements AdminDeletedFaxNumberEvent { * @param deletedFaxNumber Deleted land-line number */ public AdminFaxNumberDeletedEvent (final DialableFaxNumber deletedFaxNumber) { + // Check parameter + if (null == deletedFaxNumber) { + // Throw NPE + throw new NullPointerException("Parameter 'deletedFaxNumber' is null"); //NOI18M + } else if (deletedFaxNumber.getPhoneId() == null) { + // Throw it again + throw new NullPointerException("deletedFaxNumber.phoneId is null"); //NOI18M + } else if (deletedFaxNumber.getPhoneId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("deletedFaxNumber.phoneId={0} is invalid", deletedFaxNumber.getPhoneId())); //NOI18M + } else if (deletedFaxNumber.getPhoneAreaCode() == null) { + // Throw it again + throw new NullPointerException("deletedFaxNumber.phoneAreaCode is null"); //NOI18M + } else if (deletedFaxNumber.getPhoneAreaCode() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("deletedFaxNumber.phoneAreaCode={0} is invalid", deletedFaxNumber.getPhoneAreaCode())); //NOI18M + } else if (deletedFaxNumber.getPhoneNumber() == null) { + // Throw it again + throw new NullPointerException("deletedFaxNumber.phoneNumber is null"); //NOI18M + } else if (deletedFaxNumber.getPhoneNumber() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("deletedFaxNumber.phoneNumber={0} is invalid", deletedFaxNumber.getPhoneNumber())); //NOI18M + } else if (deletedFaxNumber.getPhoneCountry() == null) { + // Throw it again + throw new NullPointerException("deletedFaxNumber.phoneCountry is null"); //NOI18M + } else if (deletedFaxNumber.getPhoneCountry().getCountryId() == null) { + // Throw it again + throw new NullPointerException("deletedFaxNumber.phoneCountry.countryId is null"); //NOI18M + } else if (deletedFaxNumber.getPhoneCountry().getCountryId() < 1) { + // Throw it again + throw new NullPointerException(MessageFormat.format("deletedFaxNumber.phoneCountry.countryId={0} is invalid", deletedFaxNumber.getPhoneCountry().getCountryId())); //NOI18M + } + // Set it here this.deletedFaxNumber = deletedFaxNumber; } diff --git a/src/org/mxchange/jphone/events/fax/deleted/ObservableAdminFaxNumberDeletedEvent.java b/src/org/mxchange/jphone/events/fax/deleted/ObservableAdminFaxNumberDeletedEvent.java new file mode 100644 index 0000000..52aa0fe --- /dev/null +++ b/src/org/mxchange/jphone/events/fax/deleted/ObservableAdminFaxNumberDeletedEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.fax.deleted; + +import java.io.Serializable; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; + +/** + * An interface for an event when a fax number has been deleted + *

+ * @author Roland Häder + */ +public interface ObservableAdminFaxNumberDeletedEvent extends Serializable { + + /** + * Getter for deleted fax numbers + *

+ * @return Deleted fax numbers + */ + DialableFaxNumber getDeletedFaxNumber (); + +} diff --git a/src/org/mxchange/jphone/events/fax/removed/AdminFaxNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/fax/removed/AdminFaxNumberRemovedFromListEvent.java index 8de0182..02147e5 100644 --- a/src/org/mxchange/jphone/events/fax/removed/AdminFaxNumberRemovedFromListEvent.java +++ b/src/org/mxchange/jphone/events/fax/removed/AdminFaxNumberRemovedFromListEvent.java @@ -24,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; *

* @author Roland Häder */ -public class AdminFaxNumberRemovedFromListEvent implements AdminRemoveFaxNumberFromListEvent { +public class AdminFaxNumberRemovedFromListEvent implements ObservableAdminFaxNumberRemovedFromListEvent { /** * Serial number @@ -42,6 +42,12 @@ public class AdminFaxNumberRemovedFromListEvent implements AdminRemoveFaxNumberF * @param faxNumberList Fax number list */ public AdminFaxNumberRemovedFromListEvent (final List faxNumberList) { + // Check parameter + if (null == faxNumberList) { + // Throw NPE + throw new NullPointerException("Parameter 'faxNumberList' is null"); //NOI18N + } + // Set it here this.faxNumberList = faxNumberList; } diff --git a/src/org/mxchange/jphone/events/fax/removed/AdminRemoveFaxNumberFromListEvent.java b/src/org/mxchange/jphone/events/fax/removed/AdminRemoveFaxNumberFromListEvent.java deleted file mode 100644 index 37cb48d..0000000 --- a/src/org/mxchange/jphone/events/fax/removed/AdminRemoveFaxNumberFromListEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.fax.removed; - -import java.io.Serializable; -import java.util.List; -import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; - -/** - * An interface for an event when a list needs to be cleared from fax - * numbers. - *

- * @author Roland Häder - */ -public interface AdminRemoveFaxNumberFromListEvent extends Serializable { - - /** - * Getter for fax numer list - *

- * @return fax number list - */ - List getFaxNumberList (); - -} diff --git a/src/org/mxchange/jphone/events/fax/removed/ObservableAdminFaxNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/fax/removed/ObservableAdminFaxNumberRemovedFromListEvent.java new file mode 100644 index 0000000..efa789f --- /dev/null +++ b/src/org/mxchange/jphone/events/fax/removed/ObservableAdminFaxNumberRemovedFromListEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.fax.removed; + +import java.io.Serializable; +import java.util.List; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; + +/** + * An interface for an event when a list needs to be cleared from fax + * numbers. + *

+ * @author Roland Häder + */ +public interface ObservableAdminFaxNumberRemovedFromListEvent extends Serializable { + + /** + * Getter for fax numer list + *

+ * @return fax number list + */ + List getFaxNumberList (); + +} diff --git a/src/org/mxchange/jphone/events/fax/updated/AdminFaxNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/fax/updated/AdminFaxNumberUpdatedEvent.java index 9905057..fa60783 100644 --- a/src/org/mxchange/jphone/events/fax/updated/AdminFaxNumberUpdatedEvent.java +++ b/src/org/mxchange/jphone/events/fax/updated/AdminFaxNumberUpdatedEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.fax.updated; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; /** @@ -23,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; *

* @author Roland Häder */ -public class AdminFaxNumberUpdatedEvent implements AdminUpdatedFaxNumberEvent { +public class AdminFaxNumberUpdatedEvent implements ObservableAdminFaxNumberUpdatedEvent { /** * Serial number @@ -41,6 +42,39 @@ public class AdminFaxNumberUpdatedEvent implements AdminUpdatedFaxNumberEvent { * @param updatedFaxNumber Updated fax number */ public AdminFaxNumberUpdatedEvent (final DialableFaxNumber updatedFaxNumber) { + // Check parameter + if (null == updatedFaxNumber) { + // Throw NPE + throw new NullPointerException("Parameter 'updatedFaxNumber' is null"); //NOI18M + } else if (updatedFaxNumber.getPhoneId() == null) { + // Throw it again + throw new NullPointerException("updatedFaxNumber.phoneId is null"); //NOI18M + } else if (updatedFaxNumber.getPhoneId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneId={0} is invalid", updatedFaxNumber.getPhoneId())); //NOI18M + } else if (updatedFaxNumber.getPhoneAreaCode() == null) { + // Throw it again + throw new NullPointerException("updatedFaxNumber.phoneAreaCode is null"); //NOI18M + } else if (updatedFaxNumber.getPhoneAreaCode() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneAreaCode={0} is invalid", updatedFaxNumber.getPhoneAreaCode())); //NOI18M + } else if (updatedFaxNumber.getPhoneNumber() == null) { + // Throw it again + throw new NullPointerException("updatedFaxNumber.phoneNumber is null"); //NOI18M + } else if (updatedFaxNumber.getPhoneNumber() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("updatedFaxNumber.phoneNumber={0} is invalid", updatedFaxNumber.getPhoneNumber())); //NOI18M + } else if (updatedFaxNumber.getPhoneCountry() == null) { + // Throw it again + throw new NullPointerException("updatedFaxNumber.phoneCountry is null"); //NOI18M + } else if (updatedFaxNumber.getPhoneCountry().getCountryId() == null) { + // Throw it again + throw new NullPointerException("updatedFaxNumber.phoneCountry.countryId is null"); //NOI18M + } else if (updatedFaxNumber.getPhoneCountry().getCountryId() < 1) { + // Throw it again + throw new NullPointerException(MessageFormat.format("updatedFaxNumber.phoneCountry.countryId={0} is invalid", updatedFaxNumber.getPhoneCountry().getCountryId())); //NOI18M + } + // Set it here this.updatedFaxNumber = updatedFaxNumber; } diff --git a/src/org/mxchange/jphone/events/fax/updated/AdminUpdatedFaxNumberEvent.java b/src/org/mxchange/jphone/events/fax/updated/AdminUpdatedFaxNumberEvent.java deleted file mode 100644 index a7d53ae..0000000 --- a/src/org/mxchange/jphone/events/fax/updated/AdminUpdatedFaxNumberEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.fax.updated; - -import java.io.Serializable; -import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; - -/** - * An interface for an event when a fax number has been updated - *

- * @author Roland Häder - */ -public interface AdminUpdatedFaxNumberEvent extends Serializable { - - /** - * Getter for updated fax numbers - *

- * @return Updated fax numbers - */ - DialableFaxNumber getUpdatedFaxNumber (); - -} diff --git a/src/org/mxchange/jphone/events/fax/updated/ObservableAdminFaxNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/fax/updated/ObservableAdminFaxNumberUpdatedEvent.java new file mode 100644 index 0000000..2022c45 --- /dev/null +++ b/src/org/mxchange/jphone/events/fax/updated/ObservableAdminFaxNumberUpdatedEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.fax.updated; + +import java.io.Serializable; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; + +/** + * An interface for an event when a fax number has been updated + *

+ * @author Roland Häder + */ +public interface ObservableAdminFaxNumberUpdatedEvent extends Serializable { + + /** + * Getter for updated fax numbers + *

+ * @return Updated fax numbers + */ + DialableFaxNumber getUpdatedFaxNumber (); + +} diff --git a/src/org/mxchange/jphone/events/landline/created/CreatedLandLineNumberEvent.java b/src/org/mxchange/jphone/events/landline/created/CreatedLandLineNumberEvent.java index d069df6..27e75bf 100644 --- a/src/org/mxchange/jphone/events/landline/created/CreatedLandLineNumberEvent.java +++ b/src/org/mxchange/jphone/events/landline/created/CreatedLandLineNumberEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.landline.created; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** @@ -42,6 +43,40 @@ public class CreatedLandLineNumberEvent implements ObservableCreatedLandLineNumb * @param landLineNumber Land-line number instance */ public CreatedLandLineNumberEvent (final DialableLandLineNumber landLineNumber) { + // Check parameter + if (null == landLineNumber) { + // Throw NPE + throw new NullPointerException("Parameter 'landLineNumber' is null"); //NOI18M + } else if (landLineNumber.getPhoneId() == null) { + // Throw it again + throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18M + } else if (landLineNumber.getPhoneId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is invalid", landLineNumber.getPhoneId())); //NOI18M + } else if (landLineNumber.getPhoneAreaCode() == null) { + // Throw it again + throw new NullPointerException("landLineNumber.phoneAreaCode is null"); //NOI18M + } else if (landLineNumber.getPhoneAreaCode() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneAreaCode={0} is invalid", landLineNumber.getPhoneAreaCode())); //NOI18M + } else if (landLineNumber.getPhoneNumber() == null) { + // Throw it again + throw new NullPointerException("landLineNumber.phoneNumber is null"); //NOI18M + } else if (landLineNumber.getPhoneNumber() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneNumber={0} is invalid", landLineNumber.getPhoneNumber())); //NOI18M + } else if (landLineNumber.getPhoneCountry() == null) { + // Throw it again + throw new NullPointerException("landLineNumber.phoneCountry is null"); //NOI18M + } else if (landLineNumber.getPhoneCountry().getCountryId() == null) { + // Throw it again + throw new NullPointerException("landLineNumber.phoneCountry.countryId is null"); //NOI18M + } else if (landLineNumber.getPhoneCountry().getCountryId() < 1) { + // Throw it again + throw new NullPointerException(MessageFormat.format("landLineNumber.phoneCountry.countryId={0} is invalid", landLineNumber.getPhoneCountry().getCountryId())); //NOI18M + } + + // Set it here this.landLineNumber = landLineNumber; } diff --git a/src/org/mxchange/jphone/events/landline/deleted/AdminDeletedLandLineNumberEvent.java b/src/org/mxchange/jphone/events/landline/deleted/AdminDeletedLandLineNumberEvent.java deleted file mode 100644 index 72c1b4f..0000000 --- a/src/org/mxchange/jphone/events/landline/deleted/AdminDeletedLandLineNumberEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.landline.deleted; - -import java.io.Serializable; -import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; - -/** - * An interface for an event when a land-line number has been deleted - *

- * @author Roland Häder - */ -public interface AdminDeletedLandLineNumberEvent extends Serializable { - - /** - * Getter for deleted land-line numbers - *

- * @return Deleted land-line numbers - */ - DialableLandLineNumber getDeletedLandLineNumber (); - -} diff --git a/src/org/mxchange/jphone/events/landline/deleted/AdminLandLineNumberDeletedEvent.java b/src/org/mxchange/jphone/events/landline/deleted/AdminLandLineNumberDeletedEvent.java index 1e6d235..55b467a 100644 --- a/src/org/mxchange/jphone/events/landline/deleted/AdminLandLineNumberDeletedEvent.java +++ b/src/org/mxchange/jphone/events/landline/deleted/AdminLandLineNumberDeletedEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.landline.deleted; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** @@ -23,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; *

* @author Roland Häder */ -public class AdminLandLineNumberDeletedEvent implements AdminDeletedLandLineNumberEvent { +public class AdminLandLineNumberDeletedEvent implements ObservableAdminLandLineNumberDeletedEvent { /** * Serial number @@ -41,6 +42,39 @@ public class AdminLandLineNumberDeletedEvent implements AdminDeletedLandLineNumb * @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; } diff --git a/src/org/mxchange/jphone/events/landline/deleted/ObservableAdminLandLineNumberDeletedEvent.java b/src/org/mxchange/jphone/events/landline/deleted/ObservableAdminLandLineNumberDeletedEvent.java new file mode 100644 index 0000000..358c7ee --- /dev/null +++ b/src/org/mxchange/jphone/events/landline/deleted/ObservableAdminLandLineNumberDeletedEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.landline.deleted; + +import java.io.Serializable; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; + +/** + * An interface for an event when a land-line number has been deleted + *

+ * @author Roland Häder + */ +public interface ObservableAdminLandLineNumberDeletedEvent extends Serializable { + + /** + * Getter for deleted land-line numbers + *

+ * @return Deleted land-line numbers + */ + DialableLandLineNumber getDeletedLandLineNumber (); + +} diff --git a/src/org/mxchange/jphone/events/landline/removed/AdminLandLineNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/landline/removed/AdminLandLineNumberRemovedFromListEvent.java index a58f470..478f596 100644 --- a/src/org/mxchange/jphone/events/landline/removed/AdminLandLineNumberRemovedFromListEvent.java +++ b/src/org/mxchange/jphone/events/landline/removed/AdminLandLineNumberRemovedFromListEvent.java @@ -24,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; *

* @author Roland Häder */ -public class AdminLandLineNumberRemovedFromListEvent implements AdminRemoveLandLineNumberFromListEvent { +public class AdminLandLineNumberRemovedFromListEvent implements ObservableAdminLandLineNumberRemovedFromListEvent { /** * Serial number diff --git a/src/org/mxchange/jphone/events/landline/removed/AdminRemoveLandLineNumberFromListEvent.java b/src/org/mxchange/jphone/events/landline/removed/AdminRemoveLandLineNumberFromListEvent.java deleted file mode 100644 index 85cc674..0000000 --- a/src/org/mxchange/jphone/events/landline/removed/AdminRemoveLandLineNumberFromListEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.landline.removed; - -import java.io.Serializable; -import java.util.List; -import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; - -/** - * An interface for an event when a list needs to be cleared from land-line - * numbers. - *

- * @author Roland Häder - */ -public interface AdminRemoveLandLineNumberFromListEvent extends Serializable { - - /** - * Getter for land-line numer list - *

- * @return Land-line number list - */ - List getLandLineNumberList (); - -} diff --git a/src/org/mxchange/jphone/events/landline/removed/ObservableAdminLandLineNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/landline/removed/ObservableAdminLandLineNumberRemovedFromListEvent.java new file mode 100644 index 0000000..7dac773 --- /dev/null +++ b/src/org/mxchange/jphone/events/landline/removed/ObservableAdminLandLineNumberRemovedFromListEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.landline.removed; + +import java.io.Serializable; +import java.util.List; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; + +/** + * An interface for an event when a list needs to be cleared from land-line + * numbers. + *

+ * @author Roland Häder + */ +public interface ObservableAdminLandLineNumberRemovedFromListEvent extends Serializable { + + /** + * Getter for land-line numer list + *

+ * @return Land-line number list + */ + List getLandLineNumberList (); + +} diff --git a/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java index a3b57ef..db07df4 100644 --- a/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java +++ b/src/org/mxchange/jphone/events/landline/updated/AdminLandLineNumberUpdatedEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.landline.updated; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; /** @@ -23,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; *

* @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; } diff --git a/src/org/mxchange/jphone/events/landline/updated/AdminUpdatedLandLineNumberEvent.java b/src/org/mxchange/jphone/events/landline/updated/AdminUpdatedLandLineNumberEvent.java deleted file mode 100644 index 1cd3207..0000000 --- a/src/org/mxchange/jphone/events/landline/updated/AdminUpdatedLandLineNumberEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.landline.updated; - -import java.io.Serializable; -import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; - -/** - * An interface for an event when a land-line number has been updated - *

- * @author Roland Häder - */ -public interface AdminUpdatedLandLineNumberEvent extends Serializable { - - /** - * Getter for updated land-line numbers - *

- * @return Updated land-line numbers - */ - DialableLandLineNumber getUpdatedLandLineNumber (); - -} diff --git a/src/org/mxchange/jphone/events/landline/updated/ObservableAdminLandLineNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/landline/updated/ObservableAdminLandLineNumberUpdatedEvent.java new file mode 100644 index 0000000..d7e3155 --- /dev/null +++ b/src/org/mxchange/jphone/events/landline/updated/ObservableAdminLandLineNumberUpdatedEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.landline.updated; + +import java.io.Serializable; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; + +/** + * An interface for an event when a land-line number has been updated + *

+ * @author Roland Häder + */ +public interface ObservableAdminLandLineNumberUpdatedEvent extends Serializable { + + /** + * Getter for updated land-line numbers + *

+ * @return Updated land-line numbers + */ + DialableLandLineNumber getUpdatedLandLineNumber (); + +} diff --git a/src/org/mxchange/jphone/events/mobile/created/CreatedMobileNumberEvent.java b/src/org/mxchange/jphone/events/mobile/created/CreatedMobileNumberEvent.java index 4ba4878..a3c92a0 100644 --- a/src/org/mxchange/jphone/events/mobile/created/CreatedMobileNumberEvent.java +++ b/src/org/mxchange/jphone/events/mobile/created/CreatedMobileNumberEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.mobile.created; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** @@ -42,6 +43,34 @@ public class CreatedMobileNumberEvent implements ObservableCreatedMobileNumberEv * @param mobileNumber Mobile number instance */ public CreatedMobileNumberEvent (final DialableMobileNumber mobileNumber) { + // Check parameter + if (null == mobileNumber) { + // Throw NPE + throw new NullPointerException("Parameter 'mobileNumber' is null"); //NOI18M + } else if (mobileNumber.getMobileId() == null) { + // Throw it again + throw new NullPointerException("mobileNumber.mobileId is null"); //NOI18M + } else if (mobileNumber.getMobileId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileId={0} is invalid", mobileNumber.getMobileId())); //NOI18M + } else if (mobileNumber.getMobileNumber() == null) { + // Throw it again + throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18M + } else if (mobileNumber.getMobileNumber() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileNumber={0} is invalid", mobileNumber.getMobileNumber())); //NOI18M + } else if (mobileNumber.getMobileProvider() == null) { + // Throw NPE again + throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18M + } else if (mobileNumber.getMobileProvider().getProviderId() == null) { + // Throw it again + throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18M + } else if (mobileNumber.getMobileProvider().getProviderId() < 1) { + // Throw it again + throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is invalid", mobileNumber.getMobileProvider().getProviderId())); //NOI18M + } + + // Set it here this.mobileNumber = mobileNumber; } diff --git a/src/org/mxchange/jphone/events/mobile/deleted/AdminDeletedMobileNumberEvent.java b/src/org/mxchange/jphone/events/mobile/deleted/AdminDeletedMobileNumberEvent.java deleted file mode 100644 index f86a63f..0000000 --- a/src/org/mxchange/jphone/events/mobile/deleted/AdminDeletedMobileNumberEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.mobile.deleted; - -import java.io.Serializable; -import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; - -/** - * An interface for an event when a mobile number has been deleted - *

- * @author Roland Häder - */ -public interface AdminDeletedMobileNumberEvent extends Serializable { - - /** - * Getter for deleted mobile numbers - *

- * @return Deleted mobile numbers - */ - DialableMobileNumber getDeletedMobileNumber (); - -} diff --git a/src/org/mxchange/jphone/events/mobile/deleted/AdminMobileNumberDeletedEvent.java b/src/org/mxchange/jphone/events/mobile/deleted/AdminMobileNumberDeletedEvent.java index fd2fc01..eaf6fc6 100644 --- a/src/org/mxchange/jphone/events/mobile/deleted/AdminMobileNumberDeletedEvent.java +++ b/src/org/mxchange/jphone/events/mobile/deleted/AdminMobileNumberDeletedEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.mobile.deleted; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** @@ -23,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; *

* @author Roland Häder */ -public class AdminMobileNumberDeletedEvent implements AdminDeletedMobileNumberEvent { +public class AdminMobileNumberDeletedEvent implements ObservableAdminMobileNumberDeletedEvent { /** * Serial number @@ -41,6 +42,33 @@ public class AdminMobileNumberDeletedEvent implements AdminDeletedMobileNumberEv * @param deletedMobileNumber Mobile number */ public AdminMobileNumberDeletedEvent (final DialableMobileNumber deletedMobileNumber) { + // Check parameter + if (null == deletedMobileNumber) { + // Throw NPE + throw new NullPointerException("Parameter 'deletedMobileNumber' is null"); //NOI18M + } else if (deletedMobileNumber.getMobileId() == null) { + // Throw it again + throw new NullPointerException("deletedMobileNumber.mobileId is null"); //NOI18M + } else if (deletedMobileNumber.getMobileId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("deletedMobileNumber.mobileId={0} is invalid", deletedMobileNumber.getMobileId())); //NOI18M + } else if (deletedMobileNumber.getMobileNumber() == null) { + // Throw it again + throw new NullPointerException("deletedMobileNumber.mobileNumber is null"); //NOI18M + } else if (deletedMobileNumber.getMobileNumber() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("deletedMobileNumber.mobileNumber={0} is invalid", deletedMobileNumber.getMobileNumber())); //NOI18M + } else if (deletedMobileNumber.getMobileProvider() == null) { + // Throw NPE again + throw new NullPointerException("deletedMobileNumber.mobileProvider is null"); //NOI18M + } else if (deletedMobileNumber.getMobileProvider().getProviderId() == null) { + // Throw it again + throw new NullPointerException("deletedMobileNumber.mobileProvider.providerId is null"); //NOI18M + } else if (deletedMobileNumber.getMobileProvider().getProviderId() < 1) { + // Throw it again + throw new IllegalArgumentException(MessageFormat.format("deletedMobileNumber.mobileProvider.providerId={0} is invalid", deletedMobileNumber.getMobileProvider().getProviderId())); //NOI18M + } + // Set it here this.deletedMobileNumber = deletedMobileNumber; } diff --git a/src/org/mxchange/jphone/events/mobile/deleted/ObservableAdminMobileNumberDeletedEvent.java b/src/org/mxchange/jphone/events/mobile/deleted/ObservableAdminMobileNumberDeletedEvent.java new file mode 100644 index 0000000..f0a7a28 --- /dev/null +++ b/src/org/mxchange/jphone/events/mobile/deleted/ObservableAdminMobileNumberDeletedEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.mobile.deleted; + +import java.io.Serializable; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; + +/** + * An interface for an event when a mobile number has been deleted + *

+ * @author Roland Häder + */ +public interface ObservableAdminMobileNumberDeletedEvent extends Serializable { + + /** + * Getter for deleted mobile numbers + *

+ * @return Deleted mobile numbers + */ + DialableMobileNumber getDeletedMobileNumber (); + +} diff --git a/src/org/mxchange/jphone/events/mobile/remove/AdminMobileNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/mobile/remove/AdminMobileNumberRemovedFromListEvent.java index 277a998..ce0e453 100644 --- a/src/org/mxchange/jphone/events/mobile/remove/AdminMobileNumberRemovedFromListEvent.java +++ b/src/org/mxchange/jphone/events/mobile/remove/AdminMobileNumberRemovedFromListEvent.java @@ -24,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; *

* @author Roland Häder */ -public class AdminMobileNumberRemovedFromListEvent implements AdminRemoveMobileNumberFromListEvent { +public class AdminMobileNumberRemovedFromListEvent implements ObservableAdminMobileNumberRemovedFromListEvent { /** * Serial number @@ -42,6 +42,12 @@ public class AdminMobileNumberRemovedFromListEvent implements AdminRemoveMobileN * @param mobileNumberList Mobile number list */ public AdminMobileNumberRemovedFromListEvent (final List mobileNumberList) { + // Check parameter + if (null == mobileNumberList) { + // Throw NPE + throw new NullPointerException("Parameter 'mobileNumberList' is null"); //NOI18N + } + // Set it here this.mobileNumberList = mobileNumberList; } diff --git a/src/org/mxchange/jphone/events/mobile/remove/AdminRemoveMobileNumberFromListEvent.java b/src/org/mxchange/jphone/events/mobile/remove/AdminRemoveMobileNumberFromListEvent.java deleted file mode 100644 index cea2221..0000000 --- a/src/org/mxchange/jphone/events/mobile/remove/AdminRemoveMobileNumberFromListEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.mobile.remove; - -import java.io.Serializable; -import java.util.List; -import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; - -/** - * An interface for an event when a list needs to be cleared from mobile - * numbers. - *

- * @author Roland Häder - */ -public interface AdminRemoveMobileNumberFromListEvent extends Serializable { - - /** - * Getter for mobile numer list - *

- * @return Mobile number list - */ - List getMobileNumberList (); - -} diff --git a/src/org/mxchange/jphone/events/mobile/remove/ObservableAdminMobileNumberRemovedFromListEvent.java b/src/org/mxchange/jphone/events/mobile/remove/ObservableAdminMobileNumberRemovedFromListEvent.java new file mode 100644 index 0000000..f62ebb7 --- /dev/null +++ b/src/org/mxchange/jphone/events/mobile/remove/ObservableAdminMobileNumberRemovedFromListEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.mobile.remove; + +import java.io.Serializable; +import java.util.List; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; + +/** + * An interface for an event when a list needs to be cleared from mobile + * numbers. + *

+ * @author Roland Häder + */ +public interface ObservableAdminMobileNumberRemovedFromListEvent extends Serializable { + + /** + * Getter for mobile numer list + *

+ * @return Mobile number list + */ + List getMobileNumberList (); + +} diff --git a/src/org/mxchange/jphone/events/mobile/updated/AdminMobileNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/mobile/updated/AdminMobileNumberUpdatedEvent.java index b1dbca9..4460070 100644 --- a/src/org/mxchange/jphone/events/mobile/updated/AdminMobileNumberUpdatedEvent.java +++ b/src/org/mxchange/jphone/events/mobile/updated/AdminMobileNumberUpdatedEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.mobile.updated; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; /** @@ -23,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; *

* @author Roland Häder */ -public class AdminMobileNumberUpdatedEvent implements AdminUpdatedMobileNumberEvent { +public class AdminMobileNumberUpdatedEvent implements ObservableAdminMobileNumberUpdatedEvent { /** * Serial number @@ -41,6 +42,33 @@ public class AdminMobileNumberUpdatedEvent implements AdminUpdatedMobileNumberEv * @param updatedMobileNumber Updated mobile number */ public AdminMobileNumberUpdatedEvent (final DialableMobileNumber updatedMobileNumber) { + // Check parameter + if (null == updatedMobileNumber) { + // Throw NPE + throw new NullPointerException("Parameter 'updatedMobileNumber' is null"); //NOI18M + } else if (updatedMobileNumber.getMobileId() == null) { + // Throw it again + throw new NullPointerException("updatedMobileNumber.mobileId is null"); //NOI18M + } else if (updatedMobileNumber.getMobileId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("updatedMobileNumber.mobileId={0} is invalid", updatedMobileNumber.getMobileId())); //NOI18M + } else if (updatedMobileNumber.getMobileNumber() == null) { + // Throw it again + throw new NullPointerException("updatedMobileNumber.mobileNumber is null"); //NOI18M + } else if (updatedMobileNumber.getMobileNumber() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("updatedMobileNumber.mobileNumber={0} is invalid", updatedMobileNumber.getMobileNumber())); //NOI18M + } else if (updatedMobileNumber.getMobileProvider() == null) { + // Throw NPE again + throw new NullPointerException("updatedMobileNumber.mobileProvider is null"); //NOI18M + } else if (updatedMobileNumber.getMobileProvider().getProviderId() == null) { + // Throw it again + throw new NullPointerException("updatedMobileNumber.mobileProvider.providerId is null"); //NOI18M + } else if (updatedMobileNumber.getMobileProvider().getProviderId() < 1) { + // Throw it again + throw new IllegalArgumentException(MessageFormat.format("updatedMobileNumber.mobileProvider.providerId={0} is invalid", updatedMobileNumber.getMobileProvider().getProviderId())); //NOI18M + } + // Set it here this.updatedMobileNumber = updatedMobileNumber; } diff --git a/src/org/mxchange/jphone/events/mobile/updated/AdminUpdatedMobileNumberEvent.java b/src/org/mxchange/jphone/events/mobile/updated/AdminUpdatedMobileNumberEvent.java deleted file mode 100644 index 96530dd..0000000 --- a/src/org/mxchange/jphone/events/mobile/updated/AdminUpdatedMobileNumberEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.mobile.updated; - -import java.io.Serializable; -import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; - -/** - * An interface for an event when a mobile number has been updated - *

- * @author Roland Häder - */ -public interface AdminUpdatedMobileNumberEvent extends Serializable { - - /** - * Getter for updated mobile numbers - *

- * @return Updated mobile numbers - */ - DialableMobileNumber getUpdatedMobileNumber (); - -} diff --git a/src/org/mxchange/jphone/events/mobile/updated/ObservableAdminMobileNumberUpdatedEvent.java b/src/org/mxchange/jphone/events/mobile/updated/ObservableAdminMobileNumberUpdatedEvent.java new file mode 100644 index 0000000..af8b8c4 --- /dev/null +++ b/src/org/mxchange/jphone/events/mobile/updated/ObservableAdminMobileNumberUpdatedEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.mobile.updated; + +import java.io.Serializable; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; + +/** + * An interface for an event when a mobile number has been updated + *

+ * @author Roland Häder + */ +public interface ObservableAdminMobileNumberUpdatedEvent extends Serializable { + + /** + * Getter for updated mobile numbers + *

+ * @return Updated mobile numbers + */ + DialableMobileNumber getUpdatedMobileNumber (); + +} diff --git a/src/org/mxchange/jphone/events/mobileprovider/added/AdminAddedMobileProviderEvent.java b/src/org/mxchange/jphone/events/mobileprovider/added/AdminAddedMobileProviderEvent.java deleted file mode 100644 index 86de879..0000000 --- a/src/org/mxchange/jphone/events/mobileprovider/added/AdminAddedMobileProviderEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 - 2022 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jphone.events.mobileprovider.added; - -import java.io.Serializable; -import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; - -/** - * An interface for an event when a new mobile provider has been added. - *

- * @author Roland Häder - */ -public interface AdminAddedMobileProviderEvent extends Serializable { - - /** - * Getter for added mobile provider - *

- * @return Added mobile provider - */ - MobileProvider getAddedMobileProvider (); - -} diff --git a/src/org/mxchange/jphone/events/mobileprovider/added/AdminMobileProviderAddedEvent.java b/src/org/mxchange/jphone/events/mobileprovider/added/AdminMobileProviderAddedEvent.java index 6328291..1345f9e 100644 --- a/src/org/mxchange/jphone/events/mobileprovider/added/AdminMobileProviderAddedEvent.java +++ b/src/org/mxchange/jphone/events/mobileprovider/added/AdminMobileProviderAddedEvent.java @@ -16,6 +16,7 @@ */ package org.mxchange.jphone.events.mobileprovider.added; +import java.text.MessageFormat; import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; /** @@ -23,7 +24,7 @@ import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; *

* @author Roland Häder */ -public class AdminMobileProviderAddedEvent implements AdminAddedMobileProviderEvent { +public class AdminMobileProviderAddedEvent implements ObservableAdminMobileProviderAddedEvent { /** * Serial number @@ -41,6 +42,39 @@ public class AdminMobileProviderAddedEvent implements AdminAddedMobileProviderEv * @param addedMobileProvider Added mobile provider instance */ public AdminMobileProviderAddedEvent (final MobileProvider addedMobileProvider) { + // Check parameter + if (null == addedMobileProvider) { + // Throw NPE + throw new NullPointerException("Parameter 'addedMobileProvider' is null"); //NOI18M + } else if (addedMobileProvider.getProviderId() == null) { + // Throw it again + throw new NullPointerException("addedMobileProvider.providerId is null"); //NOI18M + } else if (addedMobileProvider.getProviderId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("addedMobileProvider.providerId={0} is invalid", addedMobileProvider.getProviderId())); //NOI18M + } else if (addedMobileProvider.getProviderName() == null) { + // Throw NPE again + throw new NullPointerException("addedMobileProvider.providerMame is null"); //NOI18M + } else if (addedMobileProvider.getProviderName().isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("addedMobileProvider.providerName is empty"); //NOI18M + } else if (addedMobileProvider.getProviderDialPrefix() == null) { + // Throw NPE again + throw new NullPointerException("addedMobileProvider.providerDialPrefix is null"); //NOI18M + } else if (addedMobileProvider.getProviderDialPrefix() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("addedMobileProvider.providerDialPrefix={0} is invalid", addedMobileProvider.getProviderDialPrefix())); //NOI18M + } else if (addedMobileProvider.getProviderCountry() == null) { + // Throw it again + throw new NullPointerException("addedMobileProvider.providerCountry is null"); //NOI18M + } else if (addedMobileProvider.getProviderCountry().getCountryId() == null) { + // Throw it again + throw new NullPointerException("addedMobileProvider.providerCountry.countryId is null"); //NOI18M + } else if (addedMobileProvider.getProviderCountry().getCountryId() < 1) { + // Throw it again + throw new NullPointerException(MessageFormat.format("addedMobileProvider.providerCountry.countryId={0} is invalid", addedMobileProvider.getProviderCountry().getCountryId())); //NOI18M + } + // Set it here this.addedMobileProvider = addedMobileProvider; } diff --git a/src/org/mxchange/jphone/events/mobileprovider/added/ObservableAdminMobileProviderAddedEvent.java b/src/org/mxchange/jphone/events/mobileprovider/added/ObservableAdminMobileProviderAddedEvent.java new file mode 100644 index 0000000..378398b --- /dev/null +++ b/src/org/mxchange/jphone/events/mobileprovider/added/ObservableAdminMobileProviderAddedEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 - 2022 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.events.mobileprovider.added; + +import java.io.Serializable; +import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider; + +/** + * An interface for an event when a new mobile provider has been added. + *

+ * @author Roland Häder + */ +public interface ObservableAdminMobileProviderAddedEvent extends Serializable { + + /** + * Getter for added mobile provider + *

+ * @return Added mobile provider + */ + MobileProvider getAddedMobileProvider (); + +}