title: What is the best way to inject a list with google-guice?
body: <p>I have three classes <code>CircleBuilder</code>, <code>SquareBuilder</code>, and <code>TriangleBuilder</code> implementing the <code>ShapeBuilder</code> interface.</p>
  
  <p>I need to initialize my <code>FormBuilder</code> and notably a <code>BuilderList</code> (extending <code>List&lt;ShapeBuilder&gt;</code>) with one instance of each class with google-guice.</p>
  
  <p>What is the best way? </p>
  
  <p>I know about the provider methods and stuff like this: </p>
  
  <pre><code>@Provides
  FormBuilder provideFormBuilder() {
      DatabaseTransactionLog instance = new FormBuilder ( &lt;numerous parameters&gt; );
  
      ShapeBuilder builder = null ; 
      builder = new CircleBuilder( &lt;numerous parameters&gt; ) ;  
      instance.addBuilder( builder ) ;
  
      builder = new SquareBuilder( &lt;numerous parameters&gt; ) ;  
      instance.addBuilder( builder ) ;
  
      // And so on
  
      return instance;
  }
  </code></pre>
  
  <p>but it would mean that I have to create my <code>FormBuilder</code> manually which defeats the purpose of using guice (because <code>FormBuilder</code> is the top element in my object graph).</p>
  
  <p>I'd love to be able to write something like this:</p>
  
  <pre><code>bind(BuilderList.class).to(CircleBuilder.class);
  bind(BuilderList.class).to(TriangleBuilder.class);
  bind(BuilderList.class).to(SquareBuilder.class);
  </code></pre>
  
  <p>Any idea?</p>