Repository: iluwatar/java-design-patterns
Issue: Add lombok to data-transfer-object pattern 
Labels: type: enhancement
info: good first issue
epic: code quality

I noticed that the pattern is well written but is using a lot of getters and setters without need. We can add lombok to it and have it cleaner to read and understand

Issue comments:
Also, I noticed that a lot of modules in the project has the same situation, should we create one issue per each, since a module is not coupled or you suggest another approach @iluwatar 
I have opened 2 PRS, haven't noticed the bot who handles contributors (sorry about that)
> Also, I noticed that a lot of modules in the project has the same situation, should we create one issue per each, since a module is not coupled or you suggest another approach @iluwatar

Yes, this approach is fine @burno1 

Pull request review comments:

Patch that resolved the issue:
diff --git a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/App.java b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/App.java
index 8a731303a664..e9164600ce7e 100644
--- a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/App.java
+++ b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/App.java
@@ -87,29 +87,29 @@ public static void main(String[] args) {
     printCustomerDetails(allCustomers);
 
     // Example 2: Product DTO
-    Product tv =
-        new Product().setId(1L).setName("TV").setSupplier("Sony").setPrice(1000D).setCost(1090D);
+
+    Product tv = Product.builder().id(1L).name("TV").supplier("Sony").price(1000D).cost(1090D).build();
     Product microwave =
-        new Product()
-            .setId(2L)
-            .setName("microwave")
-            .setSupplier("Delonghi")
-            .setPrice(1000D)
-            .setCost(1090D);
+        Product.builder()
+            .id(2L)
+            .name("microwave")
+            .supplier("Delonghi")
+            .price(1000D)
+            .cost(1090D).build();
     Product refrigerator =
-        new Product()
-            .setId(3L)
-            .setName("refrigerator")
-            .setSupplier("Botsch")
-            .setPrice(1000D)
-            .setCost(1090D);
+        Product.builder()
+            .id(3L)
+            .name("refrigerator")
+            .supplier("Botsch")
+            .price(1000D)
+            .cost(1090D).build();
     Product airConditioner =
-        new Product()
-            .setId(4L)
-            .setName("airConditioner")
-            .setSupplier("LG")
-            .setPrice(1000D)
-            .setCost(1090D);
+        Product.builder()
+            .id(4L)
+            .name("airConditioner")
+            .supplier("LG")
+            .price(1000D)
+            .cost(1090D).build();
     List<Product> products =
         new ArrayList<>(Arrays.asList(tv, microwave, refrigerator, airConditioner));
     ProductResource productResource = new ProductResource(products);
diff --git a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/product/Product.java b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/product/Product.java
index 2fed53dda8a9..633c0b82997d 100644
--- a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/product/Product.java
+++ b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/product/Product.java
@@ -24,9 +24,18 @@
  */
 package com.iluwatar.datatransfer.product;
 
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
 /**
  * {@link Product} is a entity class for product entity. This class act as entity in the demo.
  */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
 public final class Product {
   private Long id;
   private String name;
@@ -34,82 +43,14 @@ public final class Product {
   private Double cost;
   private String supplier;
 
-  /**
-   * Constructor.
-   *
-   * @param id       product id
-   * @param name     product name
-   * @param price    product price
-   * @param cost     product cost
-   * @param supplier product supplier
-   */
-  public Product(Long id, String name, Double price, Double cost, String supplier) {
-    this.id = id;
-    this.name = name;
-    this.price = price;
-    this.cost = cost;
-    this.supplier = supplier;
-  }
-
-  /**
-   * Constructor.
-   */
-  public Product() {
-  }
-
-  public Long getId() {
-    return id;
-  }
-
-  public Product setId(Long id) {
-    this.id = id;
-    return this;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public Product setName(String name) {
-    this.name = name;
-    return this;
-  }
-
-  public Double getPrice() {
-    return price;
-  }
-
-  public Product setPrice(Double price) {
-    this.price = price;
-    return this;
-  }
-
-  public Double getCost() {
-    return cost;
-  }
-
-  public Product setCost(Double cost) {
-    this.cost = cost;
-    return this;
-  }
-
-  public String getSupplier() {
-    return supplier;
-  }
-
-  public Product setSupplier(String supplier) {
-    this.supplier = supplier;
-    return this;
-  }
-
   @Override
   public String toString() {
     return "Product{"
-        + "id=" + id
-        + ", name='" + name + '\''
-        + ", price=" + price
-        + ", cost=" + cost
-        + ", supplier='" + supplier + '\''
-        + '}';
+            + "id=" + id
+            + ", name='" + name + '\''
+            + ", price=" + price
+            + ", cost=" + cost
+            + ", supplier='" + supplier + '\''
+            + '}';
   }
 }
diff --git a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/product/ProductResource.java b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/product/ProductResource.java
index a48f0bc8d702..2c3158fe5441 100644
--- a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/product/ProductResource.java
+++ b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/product/ProductResource.java
@@ -50,11 +50,11 @@ public ProductResource(final List<Product> products) {
    */
   public List<ProductDto.Response.Private> getAllProductsForAdmin() {
     return products
-        .stream()
-        .map(p -> new ProductDto.Response.Private().setId(p.getId()).setName(p.getName())
-            .setCost(p.getCost())
-            .setPrice(p.getPrice()))
-        .collect(Collectors.toList());
+            .stream()
+            .map(p -> new ProductDto.Response.Private().setId(p.getId()).setName(p.getName())
+                    .setCost(p.getCost())
+                    .setPrice(p.getPrice()))
+            .collect(Collectors.toList());
   }
 
   /**
@@ -64,10 +64,10 @@ public List<ProductDto.Response.Private> getAllProductsForAdmin() {
    */
   public List<ProductDto.Response.Public> getAllProductsForCustomer() {
     return products
-        .stream()
-        .map(p -> new ProductDto.Response.Public().setId(p.getId()).setName(p.getName())
-            .setPrice(p.getPrice()))
-        .collect(Collectors.toList());
+            .stream()
+            .map(p -> new ProductDto.Response.Public().setId(p.getId()).setName(p.getName())
+                    .setPrice(p.getPrice()))
+            .collect(Collectors.toList());
   }
 
   /**
@@ -76,12 +76,13 @@ public List<ProductDto.Response.Public> getAllProductsForCustomer() {
    * @param createProductDto save new product to list.
    */
   public void save(ProductDto.Request.Create createProductDto) {
-    products.add(new Product()
-        .setId((long) (products.size() + 1))
-        .setName(createProductDto.getName())
-        .setSupplier(createProductDto.getSupplier())
-        .setPrice(createProductDto.getPrice())
-        .setCost(createProductDto.getCost()));
+    products.add(Product.builder()
+            .id((long) (products.size() + 1))
+            .name(createProductDto.getName())
+            .supplier(createProductDto.getSupplier())
+            .price(createProductDto.getPrice())
+            .cost(createProductDto.getCost())
+            .build());
   }
 
   /**


Test patch: