title: most suitable design pattern to choose parser based on input file
body: <p>I have my input file in all XML/JSON/CSV/EXCEL formats.</p>
  
  <p>I have written separate parsers for all.
  but I wanna choose my parse at run time.</p>
  
  <p>which design pattern will be most suitable ?</p>
  
  <p>I have implemented such as</p>
  
  <pre><code>if(file.endsWith(".csv"))
  return CSVParser();
  if(file.endsWith(".json"))
  return JSONParser();
  if(file.endsWith(".xml"))
  return XMLParser();
  else
  return EXCELParser();
  </code></pre>
  
  <p>suggestion/guidelines please .</p>