]> git.mxchange.org Git - jcustomer-core.git/commitdiff
renamed to better names (Observable hints an interface)
authorRoland Häder <roland@mxchange.org>
Wed, 19 Apr 2017 23:02:47 +0000 (01:02 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 19 Apr 2017 23:02:47 +0000 (01:02 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcustomercore/events/customer/added/AdminAddedCustomerEvent.java
src/org/mxchange/jcustomercore/events/customer/added/CustomerAdminAddedEvent.java [deleted file]
src/org/mxchange/jcustomercore/events/customer/added/ObservableAdminAddedCustomerEvent.java [new file with mode: 0644]
src/org/mxchange/jcustomercore/events/customer/update/AdminCustomerDataUpdatedEvent.java [deleted file]
src/org/mxchange/jcustomercore/events/customer/update/AdminUpdatedCustomerDataEvent.java
src/org/mxchange/jcustomercore/events/customer/update/ObservableAdminUpdatedCustomerDataEvent.java [new file with mode: 0644]

index 8b13aa513a1fdaf51ff819ab49e190f57e77b2c6..bba20a32c0e16cb7c1dfe49088ed4b0ce3d5a91a 100644 (file)
  */
 package org.mxchange.jcustomercore.events.customer.added;
 
-import java.io.Serializable;
+import java.text.MessageFormat;
 import org.mxchange.jcustomercore.model.customer.Customer;
 
 /**
- * An interface for events being fired when an administrator has added a
- * customer.
+ * An event being fired when an administrator has added a new customer
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-public interface AdminAddedCustomerEvent extends Serializable {
+public class AdminAddedCustomerEvent implements ObservableAdminAddedCustomerEvent {
 
        /**
-        * Getter for added customer instance
+        * Serial number
+        */
+       private static final long serialVersionUID = 1_782_358_678_347_190L;
+
+       /**
+        * Added customer
+        */
+       private final Customer addedCustomer;
+
+       /**
+        * Constructor with valid customer instance being added (updated varriant)
         * <p>
-        * @return Added customer instance
+        * @param addedCustomer Added customer instance
         */
-       Customer getAddedCustomer ();
+       public AdminAddedCustomerEvent (final Customer addedCustomer) {
+               // The instance should be valid
+               if (null == addedCustomer) {
+                       // Throw NPE
+                       throw new NullPointerException("addedCustomer is null"); //NOI18N
+               } else if (addedCustomer.getCustomerId() == null) {
+                       // Throw NPE, again ...
+                       throw new NullPointerException("addedCustomer.customerId is null"); //NOI18N
+               } else if (addedCustomer.getCustomerId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("addedCustomer.customerId={0} is not valid", addedCustomer.getCustomerId())); //NOI18N
+               } else if (addedCustomer.getCustomerNumber() == null) {
+                       // Throw NPE, again ...
+                       throw new NullPointerException("addedCustomer.customerNumber is null"); //NOI18N
+               } else if (addedCustomer.getCustomerNumber() == null) {
+                       // Empty customer number
+                       throw new IllegalArgumentException("addedCustomer.customerNumber is empty"); //NOI18N
+               } else if (addedCustomer.getCustomerContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("addedCustomer.customerContact is null"); //NOI18N
+               } else if (addedCustomer.getCustomerContact().getContactId() == null) {
+                       // ... and again ...
+                       throw new NullPointerException("addedCustomer.customerContact.contactId is null"); //NOI18N
+               } else if (addedCustomer.getCustomerContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("addedCustomer.customerContact.contactId={0} is not valid", addedCustomer.getCustomerContact().getContactId())); //NOI18N
+               }
+
+               // Set it here
+               this.addedCustomer = addedCustomer;
+       }
+
+       @Override
+       public Customer getAddedCustomer () {
+               return this.addedCustomer;
+       }
 
 }
diff --git a/src/org/mxchange/jcustomercore/events/customer/added/CustomerAdminAddedEvent.java b/src/org/mxchange/jcustomercore/events/customer/added/CustomerAdminAddedEvent.java
deleted file mode 100644 (file)
index d1c2e26..0000000
+++ /dev/null
@@ -1,81 +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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcustomercore.events.customer.added;
-
-import java.text.MessageFormat;
-import org.mxchange.jcustomercore.model.customer.Customer;
-
-/**
- * An event being fired when an administrator has added a new customer
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class CustomerAdminAddedEvent implements AdminAddedCustomerEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 1_782_358_678_347_190L;
-
-       /**
-        * Added customer
-        */
-       private final Customer addedCustomer;
-
-       /**
-        * Constructor with valid customer instance being added (updated varriant)
-        * <p>
-        * @param addedCustomer Added customer instance
-        */
-       public CustomerAdminAddedEvent (final Customer addedCustomer) {
-               // The instance should be valid
-               if (null == addedCustomer) {
-                       // Throw NPE
-                       throw new NullPointerException("addedCustomer is null"); //NOI18N
-               } else if (addedCustomer.getCustomerId() == null) {
-                       // Throw NPE, again ...
-                       throw new NullPointerException("addedCustomer.customerId is null"); //NOI18N
-               } else if (addedCustomer.getCustomerId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("addedCustomer.customerId={0} is not valid", addedCustomer.getCustomerId())); //NOI18N
-               } else if (addedCustomer.getCustomerNumber() == null) {
-                       // Throw NPE, again ...
-                       throw new NullPointerException("addedCustomer.customerNumber is null"); //NOI18N
-               } else if (addedCustomer.getCustomerNumber() == null) {
-                       // Empty customer number
-                       throw new IllegalArgumentException("addedCustomer.customerNumber is empty"); //NOI18N
-               } else if (addedCustomer.getCustomerContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("addedCustomer.customerContact is null"); //NOI18N
-               } else if (addedCustomer.getCustomerContact().getContactId() == null) {
-                       // ... and again ...
-                       throw new NullPointerException("addedCustomer.customerContact.contactId is null"); //NOI18N
-               } else if (addedCustomer.getCustomerContact().getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("addedCustomer.customerContact.contactId={0} is not valid", addedCustomer.getCustomerContact().getContactId())); //NOI18N
-               }
-
-               // Set it here
-               this.addedCustomer = addedCustomer;
-       }
-
-       @Override
-       public Customer getAddedCustomer () {
-               return this.addedCustomer;
-       }
-
-}
diff --git a/src/org/mxchange/jcustomercore/events/customer/added/ObservableAdminAddedCustomerEvent.java b/src/org/mxchange/jcustomercore/events/customer/added/ObservableAdminAddedCustomerEvent.java
new file mode 100644 (file)
index 0000000..79b254a
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcustomercore.events.customer.added;
+
+import java.io.Serializable;
+import org.mxchange.jcustomercore.model.customer.Customer;
+
+/**
+ * An interface for events being fired when an administrator has added a
+ * customer.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservableAdminAddedCustomerEvent extends Serializable {
+
+       /**
+        * Getter for added customer instance
+        * <p>
+        * @return Added customer instance
+        */
+       Customer getAddedCustomer ();
+
+}
diff --git a/src/org/mxchange/jcustomercore/events/customer/update/AdminCustomerDataUpdatedEvent.java b/src/org/mxchange/jcustomercore/events/customer/update/AdminCustomerDataUpdatedEvent.java
deleted file mode 100644 (file)
index 9064c42..0000000
+++ /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 <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcustomercore.events.customer.update;
-
-import java.text.MessageFormat;
-import org.mxchange.jcustomercore.model.customer.Customer;
-
-/**
- * An event being fired when the administrator has updated customer data
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class AdminCustomerDataUpdatedEvent implements AdminUpdatedCustomerDataEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 14_785_787_174_676_290L;
-
-       /**
-        * Updated customer instance
-        */
-       private final Customer updatedCustomer;
-
-       /**
-        * Constructor with updated customer instance
-        * <p>
-        * @param updatedCustomer Updated customer instance
-        */
-       public AdminCustomerDataUpdatedEvent (final Customer updatedCustomer) {
-               // Is the customer instance valid?
-               if (null == updatedCustomer) {
-                       // Throw NPE
-                       throw new NullPointerException("updatedCustomer is null"); //NOI18N
-               } else if (updatedCustomer.getCustomerId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("updatedCustomer.customerId is null"); //NOI18N
-               } else if (updatedCustomer.getCustomerId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("updatedCustomer.customerId={0} is invalid.", updatedCustomer.getCustomerId())); //NOI18N
-               }
-
-               // Set it here
-               this.updatedCustomer = updatedCustomer;
-       }
-
-       @Override
-       public Customer getUpdatedCustomer () {
-               return this.updatedCustomer;
-       }
-
-}
index ba3ac13e504e26a39f36d0a7b845c8470f1917e6..c2b437c81d333ba26dd6e4225ddf7f2c3cccd8f8 100644 (file)
  */
 package org.mxchange.jcustomercore.events.customer.update;
 
-import java.io.Serializable;
+import java.text.MessageFormat;
 import org.mxchange.jcustomercore.model.customer.Customer;
 
 /**
- * An interface for events being fired when an administrator updated customer data.
+ * An event being fired when the administrator has updated customer data
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-public interface AdminUpdatedCustomerDataEvent extends Serializable {
+public class AdminUpdatedCustomerDataEvent implements ObservableAdminUpdatedCustomerDataEvent {
 
        /**
-        * Getter for updated customer instance
+        * Serial number
+        */
+       private static final long serialVersionUID = 14_785_787_174_676_290L;
+
+       /**
+        * Updated customer instance
+        */
+       private final Customer updatedCustomer;
+
+       /**
+        * Constructor with updated customer instance
         * <p>
-        * @return Added customer instance
+        * @param updatedCustomer Updated customer instance
         */
-       Customer getUpdatedCustomer ();
+       public AdminUpdatedCustomerDataEvent (final Customer updatedCustomer) {
+               // Is the customer instance valid?
+               if (null == updatedCustomer) {
+                       // Throw NPE
+                       throw new NullPointerException("updatedCustomer is null"); //NOI18N
+               } else if (updatedCustomer.getCustomerId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("updatedCustomer.customerId is null"); //NOI18N
+               } else if (updatedCustomer.getCustomerId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("updatedCustomer.customerId={0} is invalid.", updatedCustomer.getCustomerId())); //NOI18N
+               }
+
+               // Set it here
+               this.updatedCustomer = updatedCustomer;
+       }
+
+       @Override
+       public Customer getUpdatedCustomer () {
+               return this.updatedCustomer;
+       }
 
 }
diff --git a/src/org/mxchange/jcustomercore/events/customer/update/ObservableAdminUpdatedCustomerDataEvent.java b/src/org/mxchange/jcustomercore/events/customer/update/ObservableAdminUpdatedCustomerDataEvent.java
new file mode 100644 (file)
index 0000000..ec9cef5
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcustomercore.events.customer.update;
+
+import java.io.Serializable;
+import org.mxchange.jcustomercore.model.customer.Customer;
+
+/**
+ * An interface for events being fired when an administrator updated customer data.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservableAdminUpdatedCustomerDataEvent extends Serializable {
+
+       /**
+        * Getter for updated customer instance
+        * <p>
+        * @return Added customer instance
+        */
+       Customer getUpdatedCustomer ();
+
+}