From f6490d423cd4f817dff4f2c260ec6e48a4314463 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 20 Apr 2017 01:01:22 +0200 Subject: [PATCH] renamed to better names (Observable hints interface) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../events/AdminAddedCountryEvent.java | 42 ++++++++++-- .../events/AdminEventCountryAdded.java | 66 ------------------- .../ObservableAdminAddedCountryEvent.java | 36 ++++++++++ 3 files changed, 72 insertions(+), 72 deletions(-) delete mode 100644 src/org/mxchange/jcountry/events/AdminEventCountryAdded.java create mode 100644 src/org/mxchange/jcountry/events/ObservableAdminAddedCountryEvent.java diff --git a/src/org/mxchange/jcountry/events/AdminAddedCountryEvent.java b/src/org/mxchange/jcountry/events/AdminAddedCountryEvent.java index b014c92..b1a4492 100644 --- a/src/org/mxchange/jcountry/events/AdminAddedCountryEvent.java +++ b/src/org/mxchange/jcountry/events/AdminAddedCountryEvent.java @@ -16,21 +16,51 @@ */ package org.mxchange.jcountry.events; -import java.io.Serializable; +import java.text.MessageFormat; import org.mxchange.jcountry.data.Country; /** - * An interface for a country being added by the administrator. + * An addedCountry triggered when the administrator adds a new country *

* @author Roland Häder */ -public interface AdminAddedCountryEvent extends Serializable { +public class AdminAddedCountryEvent implements ObservableAdminAddedCountryEvent { /** - * Getter for added country + * Serial number + */ + private static final long serialVersionUID = 13_856_941_875_871_769L; + + /** + * Added country + */ + private final Country addedCountry; + + /** + * Constructor with added country *

- * @return Added country + * @param addedCountry Added country */ - Country getAddedCountry (); + public AdminAddedCountryEvent (final Country addedCountry) { + // Is all valid? + if (null == addedCountry) { + // Throw NPE + throw new NullPointerException("addedCountry is null"); //NOI18N + } else if (addedCountry.getCountryId() == null) { + // And again ... + throw new NullPointerException("addedCountry.countryId is null"); //NOI18N + } else if (addedCountry.getCountryId() < 1) { + // Id is invalid + throw new IllegalArgumentException(MessageFormat.format("addedCountry.countryId={0} is not valid.", addedCountry.getCountryId())); //NOI18N + } + + // Set country + this.addedCountry = addedCountry; + } + + @Override + public Country getAddedCountry () { + return this.addedCountry; + } } diff --git a/src/org/mxchange/jcountry/events/AdminEventCountryAdded.java b/src/org/mxchange/jcountry/events/AdminEventCountryAdded.java deleted file mode 100644 index 0ba4657..0000000 --- a/src/org/mxchange/jcountry/events/AdminEventCountryAdded.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * 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.jcountry.events; - -import java.text.MessageFormat; -import org.mxchange.jcountry.data.Country; - -/** - * An addedCountry triggered when the administrator adds a new country - *

- * @author Roland Häder - */ -public class AdminEventCountryAdded implements AdminAddedCountryEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 13_856_941_875_871_769L; - - /** - * Added country - */ - private final Country addedCountry; - - /** - * Constructor with added country - *

- * @param addedCountry Added country - */ - public AdminEventCountryAdded (final Country addedCountry) { - // Is all valid? - if (null == addedCountry) { - // Throw NPE - throw new NullPointerException("addedCountry is null"); //NOI18N - } else if (addedCountry.getCountryId() == null) { - // And again ... - throw new NullPointerException("addedCountry.countryId is null"); //NOI18N - } else if (addedCountry.getCountryId() < 1) { - // Id is invalid - throw new IllegalArgumentException(MessageFormat.format("addedCountry.countryId={0} is not valid.", addedCountry.getCountryId())); //NOI18N - } - - // Set country - this.addedCountry = addedCountry; - } - - @Override - public Country getAddedCountry () { - return this.addedCountry; - } - -} diff --git a/src/org/mxchange/jcountry/events/ObservableAdminAddedCountryEvent.java b/src/org/mxchange/jcountry/events/ObservableAdminAddedCountryEvent.java new file mode 100644 index 0000000..48ccb4c --- /dev/null +++ b/src/org/mxchange/jcountry/events/ObservableAdminAddedCountryEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016 Roland Häder + * + * 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.jcountry.events; + +import java.io.Serializable; +import org.mxchange.jcountry.data.Country; + +/** + * An interface for a country being added by the administrator. + *

+ * @author Roland Häder + */ +public interface ObservableAdminAddedCountryEvent extends Serializable { + + /** + * Getter for added country + *

+ * @return Added country + */ + Country getAddedCountry (); + +} -- 2.39.5