title: How to create a generic method to accommodate any number of POJOs
body: <p>I want to use generics to instantiate common data held in various POJOs. The POJOs are structured like this,</p>
  
  <pre><code>public class A extends BasePojo {
     public String firstName;
  } 
  
  public class B extends BasePojo {
     public String lastName;
  } 
  
  public class BasePojo {
     public String middleName;
     public String gender;
  }
  </code></pre>
  
  <p>What I want to do is set the middleName and gender in the BasePojo via a generic method.</p>
  
  <pre><code>// this method is what I need help creating, it is not correct.
  public static Class&lt;? extends BasePojo &gt; setData(Class&lt;T&gt; pojo) {
     pojo.middleName = "Jason";
     pojo.gender = "male";
  }
  </code></pre>
  
  <p>What is the proper implementation for this scenario? I want to be able to pass in Class A, Class B....Class Z (any class extending BasePojo) and set different values for middleName and gender. I have tried a few other ideas, but I keep running into "incompatible type" errors. Thank you in advanced.</p>