title: Java class object from type variable
body: <p>Is there a way to get Class object from the type variable in Java generic class? Something like that:</p>
  
  <pre><code>public class Bar extends Foo&lt;T&gt; {
      public Class getParameterClass() {
          return T.class; // doesn't compile
      }
  }
  </code></pre>
  
  <p>This type information is available at compile time and therefore should not be affected by type erasure, so, theoretically, there should be a way to accomplish this. Does it exist?</p>