title: Is there a way to use a generic argument's own generic argument in Java?
body: <p>I have this interface, with two generic parameters, and a <code>Descriptor&lt;T&gt;</code> class:</p>
  <pre class="lang-java prettyprint-override"><code>public interface DescriptorFinder&lt;D extends Descriptor&lt;T&gt;, T&gt; {
      D find(Class&lt;? extends T&gt; describedClass);
  }
  
  public abstract class Descriptor&lt;T&gt; {
      private final Class&lt;? extends T&gt; describedClass;
  
      public Descriptor(Class&lt;? extends T&gt; describedClass) {
          this.describedClass = describedClass;
      }
  
      public Class&lt;? extends T&gt; getDescribedClass() {
          return describedClass;
      }
  }
  </code></pre>
  <p>Using those foundations I can create an <code>NumberDescriptor</code> to describe a number:</p>
  <pre class="lang-java prettyprint-override"><code>public class NumberDescriptor extends Descriptor&lt;Number&gt; {
      private boolean handlesDecimalPart;
  
      public NumberDescriptor(Class&lt;? extends Number&gt; describedClass) {
          super(describedClass);
      }
  
      public boolean handlesDecimalPart() {
          return handlesDecimalPart;
      }
  
      public void setHandlesDecimalPart(boolean handlesDecimalPart) {
          this.handlesDecimalPart = handlesDecimalPart;
      }
  }
  </code></pre>
  <p>And then have a <code>DescriptorFinder</code> for it:</p>
  <pre class="lang-java prettyprint-override"><code>public class NumberDescriptorFinder implements DescriptorFinder&lt;NumberDescriptor, Number&gt; {
      @Override
      public NumberDescriptor find(Class&lt;? extends Number&gt; describedClass) {
          NumberDescriptor descriptor = new NumberDescriptor(describedClass);
          
          if (describedClass == Double.class || describedClass == Float.class) {
              descriptor.setHandlesDecimalPart(true);
          }
          
          return descriptor;
      }
  }
  </code></pre>
  <p>Well, that <code>DescriptorFinder&lt;NumberDescriptor, Number&gt;</code> is pretty weird to use,  I would like to remove the second generic parameter and reduce it to <code>DescriptorFinder&lt;NumberDescriptor&gt;</code>. So I tried something like this:</p>
  <pre class="lang-java prettyprint-override"><code>public interface DescriptorFinder&lt;D extends Descriptor&lt;?&gt;&gt; {
      D find(Class&lt;? extends T&gt; describedClass); // How to get T?
  }
  </code></pre>
  <p>But I couldn't find a way to get <code>D</code>'s <code>T</code> argument, for example, if I had <code>D</code> as <code>Descriptor&lt;Number&gt;</code>, I want to get <code>Number</code> so I can have <code>Class&lt;? extends Number&gt;</code>.</p>