title: Pass parameterized type to method as argument
body: <p>This class is from vendor library:</p>
  
  <pre><code>public class JsonParser {
      public &lt;T&gt; T parse(String json, Class&lt;T&gt; type) { ... }
  }
  </code></pre>
  
  <p>These are my models:</p>
  
  <pre><code>public class Video {
      @Key
      private String title;
      public String getTitle() {
          return title;
      }
  }
  
  public class Response&lt;TResult&gt; {
      @Key
      private TResult result;
      public TResult getResult() {
          return result;
      }
      // ...
  }
  </code></pre>
  
  <p>This code works:</p>
  
  <pre><code>JsonParser parser = new JsonParser();
  String json = "{ \"title\": \"Hello world\" }";
  Video video = parser.parse(json, Video.class);
  </code></pre>
  
  <p>This code doesn't work: (syntax error at <code>Response&lt;Video&gt;.class</code>)</p>
  
  <pre><code>JsonParser parser = new JsonParser();
  String json = "{ \"result\" : { \"title\": \"Hello world\" } }";
  Response&lt;Video&gt; videoResponse = parser.parse(reader, Response&lt;Video&gt;.class);
  </code></pre>
  
  <p>This code works:</p>
  
  <pre><code>public class VideoResponse extends Response&lt;Video&gt; {
  }
  
  ...
  JsonParser parser = new JsonParser();
  String json = "{ \"result\" : { \"title\": \"Hello world\" } }";
  Response&lt;Video&gt; videoResponse = parser.parse(reader, VideoResponse.class);
  </code></pre>
  
  <p>My question is: How to pass <code>Response&lt;Video&gt;</code> class to <code>parse</code> method as parameter without creating <code>VideoResponse</code> like that. (In my program, there are many models similar to <code>Video</code>, I dont want to duplicate my code to create empty classes <code>VideoResponse</code>, <code>UserResponse</code>, <code>CommentResponse</code>, <code>ActivityResponse</code>, etc)</p>