title: java reflection question
body: <p>I'm trying to solve the following issue in reflection. I've a POJO which kind of acts as a metadata for the method signature in TestResponse class. TestResponse has a setDate() methid which takes a Date parameter. I'm trying to make this is a generic code which can accept any method and its signature to set in the response. What I'm not able to figure out is how to set the parameter Class while calling getMethod() based on the input. The input tells me to set the parameter as Date, but not sure how to achiever that. </p>
  
  <p>Here's my sample code. Ofcourse, the mdi.modifier.getClass() is wrong since it'll get String.class instead of Date.class.</p>
  
  <pre><code>TestResponse response = new TestResponse();
  Object val = "test";
  MDIBase mdi = new MDIBase("setDate", "Date");
  Method m = response.getClass().getMethod(mdi.method, mdi.modifier.getClass());
  m.invoke(response, new Object[] { val });
  </code></pre>
  
  <p>Here's MDIBase</p>
  
  <pre><code>public class MDIBase {
  public String method;
  public String modifier;
  public MDIBase(String method, String modifier){
  this.method = method;
  this.modifier = modifier;
  }
  </code></pre>
  
  <p>Any pointers will be highly appreciated.</p>
  
  <p>Thanks</p>