BAEL-4994 names updated
This commit is contained in:
parent
ff8372aa55
commit
bdec91c268
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue