From: Roland Häder Date: Fri, 27 Oct 2017 21:05:00 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ec6971a448eb608957596618e7861d9df8b76e04;p=jproduct-core.git Continued: - added entity property for currency code like EUR or USD which is suitable for java.util.Currency - that instance then may be stored anywhere where it is needed to be customized like in JSF - also entities like "branch_office" and "headquarters" may store the same value as they are maybe country-dependent Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jproduct/model/product/GenericProduct.java b/src/org/mxchange/jproduct/model/product/GenericProduct.java index e9829b9..bac7e4c 100644 --- a/src/org/mxchange/jproduct/model/product/GenericProduct.java +++ b/src/org/mxchange/jproduct/model/product/GenericProduct.java @@ -115,6 +115,11 @@ public class GenericProduct implements Product { @Column (name = "product_title", length = 100, nullable = false, unique = true) private String productTitle; + /** + * Currency code for both prices + */ + private String productCurrencyCode; + /** * Default constructor */ @@ -126,13 +131,15 @@ public class GenericProduct implements Product { *

* @param productTitle Name of product * @param productGrossPrice Product's gross price + * @param productCurrencyCode code for both prices * @param productCategory Category instance * @param productAvailability Availability (selectable by customer) */ - public GenericProduct (final String productTitle, final Float productGrossPrice, final Category productCategory, final Boolean productAvailability) { + public GenericProduct (final String productTitle, final Float productGrossPrice, final String productCurrencyCode, final Category productCategory, final Boolean productAvailability) { // Set all here this.productTitle = productTitle; this.productGrossPrice = productGrossPrice; + this.productCurrencyCode = productCurrencyCode; this.productCategory = productCategory; this.productAvailability = productAvailability; } @@ -190,6 +197,16 @@ public class GenericProduct implements Product { this.productCreated = productCreated; } + @Override + public String getProductCurrencyCode () { + return this.productCurrencyCode; + } + + @Override + public void setProductCurrencyCode (final String productCurrencyCode) { + this.productCurrencyCode = productCurrencyCode; + } + @Override public Float getProductGrossPrice () { return this.productGrossPrice; diff --git a/src/org/mxchange/jproduct/model/product/Product.java b/src/org/mxchange/jproduct/model/product/Product.java index 50b9443..083cb6a 100644 --- a/src/org/mxchange/jproduct/model/product/Product.java +++ b/src/org/mxchange/jproduct/model/product/Product.java @@ -125,6 +125,20 @@ public interface Product extends Serializable { */ void setProductGrossPrice (final Float productGrossPrice); + /** + * Getter for currency code like EUR or USD + *

+ * @return Currency code like EUR or USD + */ + String getProductCurrencyCode (); + + /** + * Setter for currency code like EUR or USD + *

+ * @param productCurrencyCode Currency code like EUR or USD + */ + void setProductCurrencyCode (final String productCurrencyCode); + /** * Getter for title. *