title: Method injection using Dagger 2
body: <p>I haven't managed to find a good explanation/example on method injection using Dagger 2. Could someone please help me understand?</p>
  
  <p>Example:</p>
  
  <pre><code>@Inject
  public Dinner makeDinner(Pasta pasta, Sauce sauce) {
      mPan.add(pasta);
      mPan.add(sauce);
      return mPan.cookDinner();
  }
  </code></pre>
  
  <p>So if I annotate my method with <code>@Inject</code>, am I correct to assume that the arguments in the method signature will be injected with defined objects from the object graph? How can I use this method in my code then? It will still expect me to supply all the arguments, when I make the method call, which sort of defeats the purpose.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>So from what I understand the Dinner object will be available if I call <code>DinnerComponent.dinner()</code>, assuming my DinnerComponent is set up like this:</p>
  
  <pre><code>@Component(modules = DinnerModule.class)
  public interface DinnerComponent {
      Dinner dinner();
  }
  </code></pre>
  
  <p>and my DinnerModule is set up like this:</p>
  
  <pre><code>@Module
  public class DinnerModule {
      public DinnerModule() {}
  
      @Provides
      Pasta providePasta() { return new Pasta(); }
  
      @Provides
      Sauce provideSauce() { return new Sauce(); }
  }
  </code></pre>
  
  <p>What happens if I want my dinner fried?
  So let's introduce this method:</p>
  
  <pre><code>@Inject
  public Dinner makeDinner(Pasta pasta, Sauce sauce) {
      mPan.add(pasta);
      mPan.add(sauce);
      return mPan.fryDinner();
  }
  </code></pre>
  
  <p>How can I specify within the component which dinner is which?</p>