title: use Builder pattern from the constructor in a subclass
body: <p>I am currently using the Builder pattern, following closely the Java implementation suggested in the Wikipedia article <em>Builder pattern</em> <a href="http://en.wikipedia.org/wiki/Builder_pattern" rel="noreferrer">http://en.wikipedia.org/wiki/Builder_pattern</a></p>
  
  <p>This is a sample code that ilustrates my implementation</p>
  
  <pre><code>public class MyPrimitiveObject {
    private String identifier="unknown";
    public static class Builder {
      private final MyPrimitiveObject obj = new MyPrimitiveObject();
      public MyPrimitiveObject build() { return obj; }
      public Builder setidentifier (String val) {
       obj.identifier = val;
       return this;
      }
    }
    public static Builder createBuilder() { return new Builder(); }
    @Override public String toString() { return "ID: "+identifier; }
  }
  </code></pre>
  
  <p>In some of my applications that use this class, I happen to find very similar building code , so I thought to subclass <code>MyPrimitiveObject</code> in <code>MySophisticatedObject</code> and move all my repeated code into its constructor.. and here is the problem. </p>
  
  <p>How may I invoke the superclass Builder and assign its returned object as my instance?</p>
  
  <pre><code>public class MySophisticatedObject extends MyPrimitiveObject {
    private String description;
    public MySophisticatedObject (String someDescription) {
      // this should be the returned object from build() !!
      Builder().setidentifier(generateUUID()).build()
      description = someDescription;
    }     
  }
  </code></pre>