title: Getting type from class name with Java generics
body: <p>I have following class, I need to get type in constructor, how can I do that?</p>
  
  <pre><code>public abstract class MyClass&lt;T&gt; {
      public MyClass()
      {
          // I need T type here ...
      }
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Here is concrete example what I want to achieve:</p>
  
  <pre><code>public abstract class Dao&lt;T&gt; {
      public void save(GoogleAppEngineEntity entity)
      {
          // save entity to datastore here
      }
  
      public GoogleAppEngineEntity getEntityById(Long id)
      {
          // return entity of class T, how can I do that ??
      }
  }
  </code></pre>
  
  <p>What I want to do is to have this class extended to all other DAOs, because other DAOs have some queries that are specific to those daos and cannot be general, but these simple queries should be generally available to all DAO interfaces/implementations...</p>