title: Unable to instantiate class because of constructor
body: <p>I'm working on a sort of package scanning.  This is probably not the best route, but I the solutions I found on Google seemed to do a whole lot more than what I need.</p>
  
  <p>I'm struggling to instantiate a class and it's driving me nuts.  Here's my code to instantiate:</p>
  
  <pre><code>    String[] packageList = {
          getPackageName(),
          "com.socket.event.handler"
      };
      for (String packageListName : packageList) {
          try {
              String className = this.getType(); // getDashboard
              className = className.substring(0, 1).toUpperCase() + className.substring(1)+"Handler"; //GetDashboardHandler
              clazz = Class.forName(packageListName+"."+className) //shows correct package/class name
                      .asSubclass(EventHandler.class);
  
              return (EventHandler) clazz.getConstructor(clazz.getClass()).newInstance(getData());
              //return (EventHandler) clazz.newInstance();
          } catch (ClassNotFoundException e) {
              //swallow, this is ok
          } catch (Exception e) {
              e.printStackTrace();
              return null;
          }
      }
  </code></pre>
  
  <p>The <code>getData()</code> used there looks like this:
      public HashMap getData() {
          return data;
      }</p>
  
  <p>The class being instantiated is:</p>
  
  <pre><code>public class GetDashboardHandler extends EventHandler&lt;GetDashboardHandler&gt; {
      public String workstationUuid;
  
      public GetDashboardHandler() {
          super();
      }
  
      public GetDashboardHandler(HashMap&lt;String, Object&gt; data) {
          super(data, GetDashboardHandler.class);
      }
  </code></pre>
  
  <p>I have a default constructor and one that with parameters to meet the specific need.  I'm still seeing this exception:</p>
  
  <pre><code>java.lang.NoSuchMethodException: com.socket.event.handler.GetDashboardHandler.&lt;init&gt;(java.lang.Class)
      at java.lang.Class.getConstructor0(Class.java:2730)
      at java.lang.Class.getConstructor(Class.java:1676)
      at com.socket.SocketMessage.getEventHandler(SocketMessage.java:88)
  </code></pre>