title: Clearing doubts about the builder pattern
body: <p>I am learning about the builder pattern, and so far I understood that, it is a great alternative to the commonly patterns used for initialization:</p>
  
  <ul>
  <li><p>Telescoping Constructor Pattern</p></li>
  <li><p>JavaBean Pattern</p></li>
  </ul>
  
  <p>The thing is, I don't really like to remove the getters and setters from the objects in my domain model. I always like to keep them as POJOs. One of the reasons I don't like it is:
  If i don't use POJOs, then it is not easy to annotate the variables when using ORM frameworks...</p>
  
  <p>So here are my doubts:
  -Is it possible to implement the builder pattern without using static inner classes?
  -If I have to use the builder pattern by using the inner class, do you think it is correct to keep the getters and the setters?
  -I did a little example for practice where I tried to avoid the inner class. 
  Could you let me what do you think about it? </p>
  
  <p><strong>Product</strong></p>
  
  <pre><code>    public class Product
  {
      private String color;
      private int price;
  
      public Product() {
      }
  
      public String getColor() {
          return color;
      }
  
      public void setColor(String color) {
          this.color = color;
      }
  
      public int getPrice() {
          return price;
      }
  
      public void setPrice(int price) {
          this.price = price;
      }
  
      public String toString() {
          return getColor() + "\n" + getPrice();
      }    
  }
  </code></pre>
  
  <p><strong>Builder</strong></p>
  
  <pre><code>public class Builder
  {
      private Product product;
  
      public Builder() {
          product = new Product();
      }
      public Builder withColor(String color) {        
          product.setColor(color);
          return this;
      }
  
       public Builder withPrice(int price) {        
          product.setPrice(price);
          return this;
      }
      public Product build() {
          return product;
      }
  }**
  </code></pre>
  
  <p><strong>Client</strong></p>
  
  <pre><code>public class Client
  {
  
      public static void main(String[] args) {
          System.out.println(new Builder().withColor("Black").withPrice(11).build());
          System.out.println("-----------------------------------------------------");
          System.out.println(new Builder().withColor("Blue").withPrice(12).build());
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/FR6AO.png" alt="enter image description here"></p>