title: Design pattern suggestion to perform pipeline operation
body: <p><strong>Problem statement:</strong>
  I have to process request similar to a pipeline.<br/>
  For example:
  <br/>
  When a request comes, it has to undergo a sequence of operations, like (step1,step2,step3...). <br/>
  So, in order to achieve that, I am using <em>Template design pattern</em>.</p>
  
  <p>Please review and suggest if I am implementing this problem correctly, or there is a better solution.<br/>
  I am suspecting my approach will introduce code smells, as I am changing values of objects very frequently.</p>
  
  <p>Also, suggest if I &amp; how can I use Java 8 to accomplish this?
  Thanks.</p>
  
  <p><strong>Code:</strong>
  <br/></p>
  
  <pre><code>package com.example.demo.design;
  
  import java.util.List;
  
  public abstract class Template {
      @Autowired
      private Step1 step1;
      @Autowired
      private Step2 step2;
      @Autowired
      private Save save;
      List&lt;String&gt; stepOutput = null;
      List&lt;String&gt; stepOutputTwo = null;
      List&lt;String&gt; stepOutputThree = null;
  
      public void step1(String action1) {
          stepOutput = step1.method(action1);
      }
  
      public void step2(String action2) {
          stepOutputTwo = step2.method(stepOutput, action2);
      }
  
      abstract public void step3();
  
      public void save() {
          save.persist(stepOutputThree);
      }
  
      final public void run(String action1, String action2) {
          step1(action1);
          step2(action2);
          stepOutputTwo = step3();
      }
  }
  </code></pre>