title: Using a generic type of a subclass within it's abstract superclass?
body: <p>Within my code a have the following abstract superclass</p>
  
  <pre><code>public abstract class AbstractClass&lt;Type extends A&gt; {...}
  </code></pre>
  
  <p>and some child classes like</p>
  
  <pre><code>public class ChildClassA extends AbstractClass&lt;GenericTypeA&gt; {...}
  
  public class ChildClassB extends AbstractClass&lt;GenericTypeB&gt; {...}
  </code></pre>
  
  <p>I'm searching for an elegant way how I can use the generic type of the child classes (GenericTypeA, GenericTypeB, ...) inside the abstract class in a generic way.</p>
  
  <p>To solve this problem I currently defined the method </p>
  
  <pre><code>protected abstract Class&lt;Type&gt; getGenericTypeClass();
  </code></pre>
  
  <p>in my abstract class and implemented the method</p>
  
  <pre><code>@Override
  protected Class&lt;GenericType&gt; getGenericTypeClass() {
      return GenericType.class;
  }
  </code></pre>
  
  <p>in every child class. </p>
  
  <p>Is it possible to get the generic type of the child classes in my abstract class without implementing this helper method?</p>
  
  <p>BR,</p>
  
  <p>Markus</p>