diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/MvcMainClass.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/MvcMainClass.java index e89d7239eb..9ccd4ee74c 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/MvcMainClass.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/MvcMainClass.java @@ -6,19 +6,19 @@ public class MvcMainClass { Product model = retrieveProductFromDatabase(); ProductView view = new ProductView(); - model.setProductView(view); + model.setView(view); model.showProduct(); ProductController controller = new ProductController(model); - controller.setProductName("SmartPhone"); + controller.setName("SmartPhone"); model.showProduct(); } private static Product retrieveProductFromDatabase() { Product product = new Product(); - product.setProductName("Mobile"); - product.setProductDescription("New Brand"); - product.setProductPrice(1000.0); + product.setName("Mobile"); + product.setDescription("New Brand"); + product.setPrice(1000.0); return product; } } diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/Product.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/Product.java index 6e04b223e4..5c44d4475a 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/Product.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/Product.java @@ -1,45 +1,45 @@ package com.baeldung.mvc_mvp.mvc; public class Product { - private String productName; - private String productDescription; - private Double productPrice; - private ProductView productView; + private String name; + private String description; + private Double price; + private ProductView view; - public String getProductName() { - return productName; + public String getName() { + return name; } - public void setProductName(String productName) { - this.productName = productName; + public void setName(String name) { + this.name = name; } - public String getProductDescription() { - return productDescription; + public String getDescription() { + return description; } - public void setProductDescription(String productDescription) { - this.productDescription = productDescription; + public void setDescription(String description) { + this.description = description; } - public Double getProductPrice() { - return productPrice; + public Double getPrice() { + return price; } - public void setProductPrice(Double productPrice) { - this.productPrice = productPrice; + public void setPrice(Double price) { + this.price = price; } - public ProductView getProductView() { - return productView; + public ProductView getView() { + return view; } - public void setProductView(ProductView productView) { - this.productView = productView; + public void setView(ProductView view) { + this.view = view; } public void showProduct() { - productView.printProductDetails(productName, productDescription, productPrice); + view.printProductDetails(name, description, price); } } diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/ProductController.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/ProductController.java index 922d4d703b..62cdb76f23 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/ProductController.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/ProductController.java @@ -7,28 +7,28 @@ public class ProductController { this.product = product; } - public String getProductName() { - return product.getProductName(); + public String getName() { + return product.getName(); } - public void setProductName(String productName) { - product.setProductName(productName); + public void setName(String name) { + product.setName(name); } - public String getProductDescription() { - return product.getProductDescription(); + public String getDescription() { + return product.getDescription(); } - public void setProductDescription(String productDescription) { - product.setProductDescription(productDescription); + public void setDescription(String description) { + product.setDescription(description); } - public Double getProductPrice() { - return product.getProductPrice(); + public Double getPrice() { + return product.getPrice(); } - public void setProductPrice(Double productPrice) { - product.setProductPrice(productPrice); + public void setPrice(Double price) { + product.setPrice(price); } } diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/ProductView.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/ProductView.java index 19ef7d3629..43f45b6df7 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/ProductView.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvc/ProductView.java @@ -6,10 +6,10 @@ import org.slf4j.LoggerFactory; public class ProductView { private static Logger log = LoggerFactory.getLogger(ProductView.class); - public void printProductDetails(String productName, String productDescription, Double productPrice) { + public void printProductDetails(String name, String description, Double price) { log.info("Product details:"); - log.info("product Name: " + productName); - log.info("product Description: " + productDescription); - log.info("product price: " + productPrice); + log.info("product Name: " + name); + log.info("product Description: " + description); + log.info("product price: " + price); } } diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/MvpMainClass.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/MvpMainClass.java index b501ac5ec5..7d12a0142c 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/MvpMainClass.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/MvpMainClass.java @@ -8,15 +8,15 @@ public class MvpMainClass { ProductView view = new ProductView(); ProductPresenter presenter = new ProductPresenter(model, view); presenter.showProduct(); - presenter.setProductName("SmartPhone"); + presenter.setName("SmartPhone"); presenter.showProduct(); } private static Product retrieveProductFromDatabase() { Product product = new Product(); - product.setProductName("Mobile"); - product.setProductDescription("New Brand"); - product.setProductPrice(1000.0); + product.setName("Mobile"); + product.setDescription("New Brand"); + product.setPrice(1000.0); return product; } } diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/Product.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/Product.java index 700ee15ef6..315e6e69b6 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/Product.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/Product.java @@ -1,32 +1,32 @@ package com.baeldung.mvc_mvp.mvp; public class Product { - private String productName; - private String productDescription; - private Double productPrice; + private String name; + private String description; + private Double price; - public String getProductName() { - return productName; + public String getName() { + return name; } - public void setProductName(String productName) { - this.productName = productName; + public void setName(String name) { + this.name = name; } - public String getProductDescription() { - return productDescription; + public String getDescription() { + return description; } - public void setProductDescription(String productDescription) { - this.productDescription = productDescription; + public void setDescription(String description) { + this.description = description; } - public Double getProductPrice() { - return productPrice; + public Double getPrice() { + return price; } - public void setProductPrice(Double productPrice) { - this.productPrice = productPrice; + public void setPrice(Double price) { + this.price = price; } } diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/ProductPresenter.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/ProductPresenter.java index 984766b299..2b87bdbbb5 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/ProductPresenter.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/ProductPresenter.java @@ -2,39 +2,39 @@ package com.baeldung.mvc_mvp.mvp; public class ProductPresenter { private final Product product; - private final ProductView productView; + private final ProductView view; - public ProductPresenter(Product product, ProductView productView) { + public ProductPresenter(Product product, ProductView view) { this.product = product; - this.productView = productView; + this.view = view; } - public String getProductName() { - return product.getProductName(); + public String getName() { + return product.getName(); } - public void setProductName(String productName) { - product.setProductName(productName); + public void setName(String name) { + product.setName(name); } - public String getProductDescription() { - return product.getProductDescription(); + public String getDescription() { + return product.getDescription(); } - public void setProductDescription(String productDescription) { - product.setProductDescription(productDescription); + public void setDescription(String description) { + product.setDescription(description); } public Double getProductPrice() { - return product.getProductPrice(); + return product.getPrice(); } - public void setProductPrice(Double productPrice) { - product.setProductPrice(productPrice); + public void setPrice(Double price) { + product.setPrice(price); } public void showProduct() { - productView.printProductDetails(product.getProductName(), product.getProductDescription(), product.getProductPrice()); + view.printProductDetails(product.getName(), product.getDescription(), product.getPrice()); } } diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/ProductView.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/ProductView.java index 4555977439..27ccc6743d 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/ProductView.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/mvc_mvp/mvp/ProductView.java @@ -6,10 +6,10 @@ import org.slf4j.LoggerFactory; public class ProductView { private static Logger log = LoggerFactory.getLogger(ProductView.class); - public void printProductDetails(String productName, String productDescription, Double productPrice) { + public void printProductDetails(String name, String description, Double price) { log.info("Product details:"); - log.info("product Name: " + productName); - log.info("product Description: " + productDescription); - log.info("product price: " + productPrice); + log.info("product Name: " + name); + log.info("product Description: " + description); + log.info("product price: " + price); } }