title: How do I call a constructor in java via reflection?
body: <p>I am dumping CSV via jackson. I have a couple of mapping classes and want to pass the mapping class to the CSV export method. </p>
  
  <p>I have an abstract class, extended it to each of the csv column formats. I pass the name of the class to the export function then want to map the data via the constructor for the class and dump it as CSV.</p>
  
  <p>All fine until I get to creating the class that does the mapping and is to be exported. </p>
  
  <p>Invocation exception/Invalid number of parameters exception.</p>
  
  <pre><code>protected String mapTransactionsToCSV(List&lt;Object[]&gt; results, String rowClassName) 
    Class rowClass  = Class.forName(rowClassName);
    for (Object[] component : results)
      VehicleAbstract vehicle  = (VehicleAbstract) rowClass.getDeclaredConstructor(Object[].class).newInstance(component);
      csv.append(mapper.writer(schema).writeValueAsString(vehicle));
    }
  }
  </code></pre>
  
  <p>My specific class (and abstract class, which I just copied to try). has 2 constructors</p>
  
  <pre><code>public Bus() {} 
  public Bus(Object[] component) {}
  </code></pre>