From 67955d5e67c4dbc2100da3148e9a0b212436e27d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 31 Mar 2018 17:57:14 +0200 Subject: [PATCH] Continued: - moved "added" event to own package - added "created" (LOL) event MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../{ => added}/AddedProductEvent.java | 2 +- .../{ => added}/ProductAddedEvent.java | 2 +- .../product/created/CreatedProductEvent.java | 54 +++++++++++++++++++ .../ObservableCreatedProductEvent.java | 37 +++++++++++++ .../model/product/agegroup/AgeGroup.java | 2 +- 5 files changed, 94 insertions(+), 3 deletions(-) rename src/org/mxchange/jproduct/events/product/{ => added}/AddedProductEvent.java (95%) rename src/org/mxchange/jproduct/events/product/{ => added}/ProductAddedEvent.java (98%) create mode 100644 src/org/mxchange/jproduct/events/product/created/CreatedProductEvent.java create mode 100644 src/org/mxchange/jproduct/events/product/created/ObservableCreatedProductEvent.java diff --git a/src/org/mxchange/jproduct/events/product/AddedProductEvent.java b/src/org/mxchange/jproduct/events/product/added/AddedProductEvent.java similarity index 95% rename from src/org/mxchange/jproduct/events/product/AddedProductEvent.java rename to src/org/mxchange/jproduct/events/product/added/AddedProductEvent.java index 7a96cf2..899aece 100644 --- a/src/org/mxchange/jproduct/events/product/AddedProductEvent.java +++ b/src/org/mxchange/jproduct/events/product/added/AddedProductEvent.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jproduct.events.product; +package org.mxchange.jproduct.events.product.added; import java.io.Serializable; import org.mxchange.jproduct.model.product.Product; diff --git a/src/org/mxchange/jproduct/events/product/ProductAddedEvent.java b/src/org/mxchange/jproduct/events/product/added/ProductAddedEvent.java similarity index 98% rename from src/org/mxchange/jproduct/events/product/ProductAddedEvent.java rename to src/org/mxchange/jproduct/events/product/added/ProductAddedEvent.java index 66f43ac..8421850 100644 --- a/src/org/mxchange/jproduct/events/product/ProductAddedEvent.java +++ b/src/org/mxchange/jproduct/events/product/added/ProductAddedEvent.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jproduct.events.product; +package org.mxchange.jproduct.events.product.added; import java.text.MessageFormat; import org.mxchange.jproduct.model.product.Product; diff --git a/src/org/mxchange/jproduct/events/product/created/CreatedProductEvent.java b/src/org/mxchange/jproduct/events/product/created/CreatedProductEvent.java new file mode 100644 index 0000000..34de314 --- /dev/null +++ b/src/org/mxchange/jproduct/events/product/created/CreatedProductEvent.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2017, 2018 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.jproduct.events.product.created; + +import org.mxchange.jproduct.model.product.Product; + +/** + * An interface for observable events being fired when a product instance has + * been successfully created. This may happen when a product profile was called. + *

+ * @author Roland Häder + */ +public class CreatedProductEvent implements ObservableCreatedProductEvent { + + /** + * Serial number + */ + private static final long serialVersionUID = 24_138_056_876_716_551L; + + /** + * Product instance being created + */ + private final Product createdProduct; + + /** + * Constructor with product instance + *

+ * @param createdProduct Product instance being created by helper + */ + public CreatedProductEvent (final Product createdProduct) { + // Set product instance + this.createdProduct = createdProduct; + } + + @Override + public Product getCreatedProduct () { + return this.createdProduct; + } + +} diff --git a/src/org/mxchange/jproduct/events/product/created/ObservableCreatedProductEvent.java b/src/org/mxchange/jproduct/events/product/created/ObservableCreatedProductEvent.java new file mode 100644 index 0000000..69ee9ab --- /dev/null +++ b/src/org/mxchange/jproduct/events/product/created/ObservableCreatedProductEvent.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2017, 2018 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.jproduct.events.product.created; + +import java.io.Serializable; +import org.mxchange.jproduct.model.product.Product; + +/** + * An interface for observable events being fired when a product instance has + * been successfully created. This may happen when a product profile was called. + *

+ * @author Roland Häder + */ +public interface ObservableCreatedProductEvent extends Serializable { + + /** + * Getter for created product instance + *

+ * @return Created product instance + */ + Product getCreatedProduct (); + +} diff --git a/src/org/mxchange/jproduct/model/product/agegroup/AgeGroup.java b/src/org/mxchange/jproduct/model/product/agegroup/AgeGroup.java index 673e945..5aed39f 100644 --- a/src/org/mxchange/jproduct/model/product/agegroup/AgeGroup.java +++ b/src/org/mxchange/jproduct/model/product/agegroup/AgeGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Haeder + * Copyright (C) 2017, 2018 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 -- 2.39.5