title: Convert CSV file into objects in a generic way
body: <p>Ok, so i want to create a generic reading function in Java without using any other libraries(except for opencsv). (I've asked a bit about it a few hours before, and thought i sorted it out but turns out it didnt work.)</p>
  
  <pre><code>public class Read {
  
      void Reader(String fileName) {
  
          Map&lt;String, String&gt; mapping = new
                  HashMap&lt;String, String&gt;();
          //mapping.put("Name", "Name");
          //mapping.put("Price", "Price");
  
          HeaderColumnNameTranslateMappingStrategy&lt;Product&gt; strategy = new HeaderColumnNameTranslateMappingStrategy&lt;&gt;();
          strategy.setType(Product.class);
          strategy.setColumnMapping(mapping);
          ...
  
      }
  }
  </code></pre>
  
  <p>This works. The problem is i need to make it generic, as i'd like to use it for different kinds of csv's. My generic skills are not exactly the best though. If i change it to</p>
  
  <pre><code>void &lt;T&gt; Reader(T Obj,...)
  ...
  </code></pre>
  
  <p>and i pass a product Obj, im not sure what to put instead of </p>
  
  <pre><code>#...&lt;Product&gt; strategy
  #and strategy.setType(Product.class)
  </code></pre>
  
  <p>I've tried adding the relative path, or using Obj.class, but i keep getting cannot convert errors.
  Any ideas?</p>
  
  <p><em>The mappings are just an example, i've tried parsing the CSV to get the object tags for any object and it works.</em></p>
  
  <p>More info:
  Tried trampering with these:</p>
  
  <pre><code>public static &lt;T&gt; void Read(T Obj,String fileName) {
  ...
  HeaderColumnNameTranslateMappingStrategy&lt;T&gt; strategy = new HeaderColumnNameTranslateMappingStrategy&lt;&gt;();
  strategy.setType(Obj.getClass());
  
  </code></pre>
  
  <pre><code>error:incompatible types: java.lang.Class&lt;capture#1 of ? extends java.lang.Object&gt; cannot be converted to java.lang.Class&lt;? extends T&gt;
  </code></pre>