title: Need suggestion on Parser Design Strategy
body: <p>I need a suggestion on Parser Design Strategy</p>
  
  <p>Consider <code>type1, type2, type3</code> are three different csv files with different formats which will be parsed by <code>Parser1, Parser2, Parser3</code> respectively.<br>
  In future this will evolve to parse info from other sources like dbs.<br>
  Also there will be new parsers to come. what is the best way to design the parser? is <code>factory</code>/ <code>abstract</code> factory a good candidate?<br>
  Some benefits and examples would be helpful?  </p>
  
  <pre><code>Type1 - Parser1    
  Type2 - Parser2    
  Type3 - Parser3
  </code></pre>
  
  <p>I have put down my code, looking for valuable suggestions.</p>
  
  <pre><code>interface Parser&lt;T&gt;{
      public List&lt;T&gt; parse (string s);
  }
  
  //where T - data model 
  
  class Parser1CSV implements Parser&lt;Model1&gt;{
      //implement 
      //s-csv file
      public List&lt;Model1&gt; parse (string s){
      }
  }
  
  class Parser1DB implements Parser&lt;Model1&gt;{
      //implement 
      //s- connection string
      public List&lt;Model1&gt; parse (string s){
      }
  }
  
  class Parser2CSV implements Parser&lt;Model2&gt;{
      //implement 
      //s-csv file
      public List&lt;Model2&gt; parse (string s){
      }
  }
  
  //same way other parsers are implemented
  
  interface AbstarctFactory&lt;T&gt;{
      public Parser&lt;T&gt; createParser();
  }
  
  class Parser1Factory implements AbstarctFactory&lt;Model1&gt;{
      private String type;
      Parser1Factory(String type){
          this.type = type;
      }
  
      public Parser&lt;Model1&gt; createParser(){
          if(type.equals("CSV"){
              return new Parser1CSV();
          }else if(type.equals("DB"){
              return Parser1DB();
          }else{
              throw UnSupportedOperationException("Not Supported.");
          }
      }
  }
  
  //same way other parser factories are implemented
  
  class ParserFactory{
      public static &lt;T&gt; Parser&lt;T&gt; getParser(AbstarctFactory&lt;T&gt; factory){
          factory.createParser();
      }
  }
  
  //Usage:
  Parser&lt;Model1&gt; parser = ParserFactory.getParser(new Parser1Factory("CSV"));
  List&lt;Model1&gt; list = parser.parse(file);
  </code></pre>
  
  <p>Currently, I'm not using DI framework. What will be the benefits and impact when I needed to use?</p>