title: Get T generic type of the class to the T in the new GenericType<List<T>>() Java
body: <p>I have implmented the follwing class and implemented a search method get list of Object for the given type of T using a REST call.  </p>
  
  <pre><code>    public class AmapiService&lt;T extends Resource&gt; implements RestService&lt;T&gt; {
  
  
      @Override
      public List&lt;T&gt; search( MultivaluedMap&lt;String, String&gt; aQueryParams ) {
            MultivaluedMap&lt;String, String&gt; lQueryParams = aQueryParams;
            Client lClient = buildClient();
  
        WebTarget ltarget = lClient.target( iRestDriver.target( aApiUrl ).getUri() );
  
        for ( String lKey : lQueryParams.keySet() ) {
           ltarget = ltarget.queryParam( lKey, lQueryParams.getFirst( lKey ) );
        }
  
        List&lt;T&gt; lObjects = null;
  
        lObjects = ltarget.request( MediaType.APPLICATION_JSON ).get( new GenericType&lt;List&lt;T&gt;&gt;() {
        } );
  
        return lObjects;
     }
  }
  </code></pre>
  
  <p>this is how the instance is created for the class and search method call.</p>
  
  <pre><code>AmapiService&lt;RFQDefinition&gt; RFQService =
              new AmapiService&lt;RFQDefinition&gt;();
  
  List&lt;RFQDefinition&gt; qfq = RFQService.search( lQueryParam );
  </code></pre>
  
  <p>when i run this im getting the following error </p>
  
  <pre><code>May 07, 2018 1:48:14 PM org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor aroundReadFrom
  SEVERE: MessageBodyReader not found for media type=application/json, type=interface java.util.List, genericType=java.util.List&lt;T&gt;.
  </code></pre>
  
  <p>That means the RFQDefinition does not set to the T in the <code>new GenericType&lt;List&lt;T&gt;&gt;().</code></p>
  
  <p>how can i set the type from the T in the <code>AmapiService&lt;T extends Resource&gt;</code>  to <code>new GenericType&lt;List&lt;T&gt;&gt;()</code></p>
  
  <p>if i define it <code>new GenericType&lt;List&lt;RFQDefinition&gt;&gt;()</code> Instead of T its working</p>