BAEL-4994 names updated

This commit is contained in:
Md Moinul Hossain 2021-07-20 11:21:17 +06:00
parent ff8372aa55
commit bdec91c268
8 changed files with 80 additions and 80 deletions

View File

@ -6,19 +6,19 @@ public class MvcMainClass {
Product model = retrieveProductFromDatabase(); Product model = retrieveProductFromDatabase();
ProductView view = new ProductView(); ProductView view = new ProductView();
model.setProductView(view); model.setView(view);
model.showProduct(); model.showProduct();
ProductController controller = new ProductController(model); ProductController controller = new ProductController(model);
controller.setProductName("SmartPhone"); controller.setName("SmartPhone");
model.showProduct(); model.showProduct();
} }
private static Product retrieveProductFromDatabase() { private static Product retrieveProductFromDatabase() {
Product product = new Product(); Product product = new Product();
product.setProductName("Mobile"); product.setName("Mobile");
product.setProductDescription("New Brand"); product.setDescription("New Brand");
product.setProductPrice(1000.0); product.setPrice(1000.0);
return product; return product;
} }
} }

View File

@ -1,45 +1,45 @@
package com.baeldung.mvc_mvp.mvc; package com.baeldung.mvc_mvp.mvc;
public class Product { public class Product {
private String productName; private String name;
private String productDescription; private String description;
private Double productPrice; private Double price;
private ProductView productView; private ProductView view;
public String getProductName() { public String getName() {
return productName; return name;
} }
public void setProductName(String productName) { public void setName(String name) {
this.productName = productName; this.name = name;
} }
public String getProductDescription() { public String getDescription() {
return productDescription; return description;
} }
public void setProductDescription(String productDescription) { public void setDescription(String description) {
this.productDescription = productDescription; this.description = description;
} }
public Double getProductPrice() { public Double getPrice() {
return productPrice; return price;
} }
public void setProductPrice(Double productPrice) { public void setPrice(Double price) {
this.productPrice = productPrice; this.price = price;
} }
public ProductView getProductView() { public ProductView getView() {
return productView; return view;
} }
public void setProductView(ProductView productView) { public void setView(ProductView view) {
this.productView = productView; this.view = view;
} }
public void showProduct() { public void showProduct() {
productView.printProductDetails(productName, productDescription, productPrice); view.printProductDetails(name, description, price);
} }
} }

View File

@ -7,28 +7,28 @@ public class ProductController {
this.product = product; this.product = product;
} }
public String getProductName() { public String getName() {
return product.getProductName(); return product.getName();
} }
public void setProductName(String productName) { public void setName(String name) {
product.setProductName(productName); product.setName(name);
} }
public String getProductDescription() { public String getDescription() {
return product.getProductDescription(); return product.getDescription();
} }
public void setProductDescription(String productDescription) { public void setDescription(String description) {
product.setProductDescription(productDescription); product.setDescription(description);
} }
public Double getProductPrice() { public Double getPrice() {
return product.getProductPrice(); return product.getPrice();
} }
public void setProductPrice(Double productPrice) { public void setPrice(Double price) {
product.setProductPrice(productPrice); product.setPrice(price);
} }
} }

View File

@ -6,10 +6,10 @@ import org.slf4j.LoggerFactory;
public class ProductView { public class ProductView {
private static Logger log = LoggerFactory.getLogger(ProductView.class); 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 details:");
log.info("product Name: " + productName); log.info("product Name: " + name);
log.info("product Description: " + productDescription); log.info("product Description: " + description);
log.info("product price: " + productPrice); log.info("product price: " + price);
} }
} }

View File

@ -8,15 +8,15 @@ public class MvpMainClass {
ProductView view = new ProductView(); ProductView view = new ProductView();
ProductPresenter presenter = new ProductPresenter(model, view); ProductPresenter presenter = new ProductPresenter(model, view);
presenter.showProduct(); presenter.showProduct();
presenter.setProductName("SmartPhone"); presenter.setName("SmartPhone");
presenter.showProduct(); presenter.showProduct();
} }
private static Product retrieveProductFromDatabase() { private static Product retrieveProductFromDatabase() {
Product product = new Product(); Product product = new Product();
product.setProductName("Mobile"); product.setName("Mobile");
product.setProductDescription("New Brand"); product.setDescription("New Brand");
product.setProductPrice(1000.0); product.setPrice(1000.0);
return product; return product;
} }
} }

View File

@ -1,32 +1,32 @@
package com.baeldung.mvc_mvp.mvp; package com.baeldung.mvc_mvp.mvp;
public class Product { public class Product {
private String productName; private String name;
private String productDescription; private String description;
private Double productPrice; private Double price;
public String getProductName() { public String getName() {
return productName; return name;
} }
public void setProductName(String productName) { public void setName(String name) {
this.productName = productName; this.name = name;
} }
public String getProductDescription() { public String getDescription() {
return productDescription; return description;
} }
public void setProductDescription(String productDescription) { public void setDescription(String description) {
this.productDescription = productDescription; this.description = description;
} }
public Double getProductPrice() { public Double getPrice() {
return productPrice; return price;
} }
public void setProductPrice(Double productPrice) { public void setPrice(Double price) {
this.productPrice = productPrice; this.price = price;
} }
} }

View File

@ -2,39 +2,39 @@ package com.baeldung.mvc_mvp.mvp;
public class ProductPresenter { public class ProductPresenter {
private final Product product; 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.product = product;
this.productView = productView; this.view = view;
} }
public String getProductName() { public String getName() {
return product.getProductName(); return product.getName();
} }
public void setProductName(String productName) { public void setName(String name) {
product.setProductName(productName); product.setName(name);
} }
public String getProductDescription() { public String getDescription() {
return product.getProductDescription(); return product.getDescription();
} }
public void setProductDescription(String productDescription) { public void setDescription(String description) {
product.setProductDescription(productDescription); product.setDescription(description);
} }
public Double getProductPrice() { public Double getProductPrice() {
return product.getProductPrice(); return product.getPrice();
} }
public void setProductPrice(Double productPrice) { public void setPrice(Double price) {
product.setProductPrice(productPrice); product.setPrice(price);
} }
public void showProduct() { public void showProduct() {
productView.printProductDetails(product.getProductName(), product.getProductDescription(), product.getProductPrice()); view.printProductDetails(product.getName(), product.getDescription(), product.getPrice());
} }
} }

View File

@ -6,10 +6,10 @@ import org.slf4j.LoggerFactory;
public class ProductView { public class ProductView {
private static Logger log = LoggerFactory.getLogger(ProductView.class); 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 details:");
log.info("product Name: " + productName); log.info("product Name: " + name);
log.info("product Description: " + productDescription); log.info("product Description: " + description);
log.info("product price: " + productPrice); log.info("product price: " + price);
} }
} }