title: Generic parser to parse row of records in java
body: <p>I have row of records which has multiple columns. Different columns could contain values of different types like Long, String, Date etc but one column would have all values of same type. I am trying to write some kind of generic parser which can deal with this. For example If I get different set of records, I should be able to configure my parser.</p>
  
  <p>Input1</p>
  
  <pre><code>1, Jitendra, 2011-02-12
  2, Xyz, 2011-02-13
  </code></pre>
  
  <p>Input2</p>
  
  <pre><code>XYZ, 34.00, 1
  ABC, 56.00, 3
  </code></pre>
  
  <p>Something like this.</p>
  
  <pre><code>Class Parser {
    int columnNo;
    String columnName;
    &lt;Something here to identify data type of column&gt; dataType;
  }
  
  Class ParsedRecord{
    String name;
    &lt;Datatype&gt; value;
  }
  </code></pre>
  
  <p>Does this approach seem to be feasible? Any suggestions?</p>
  
  <p>Thanks</p>