title: KafkaConsumer generic types for avro SpecificRecord using Reflection
body: <p>I want to initialize <code>KafkaConsumer</code> generic types using classes loaded with reflection. The classes will be generated via <code>avro-tools</code> and will be extending <code>SpecificRecordBase</code> class. I know, I can use wildcards and do something like -</p>
  <pre class="lang-java prettyprint-override"><code>KafkaConsumer&lt;? extends SpecificRecordBase, ? extends SpecificRecordBase&gt; consumer = new KafkaConsumer&lt;&gt;(properties);
  </code></pre>
  <p>However, I am looking for something like -</p>
  <pre class="lang-java prettyprint-override"><code>Class keyClass = Class.forName(&quot;com.test.KeyClass&quot;);
  Class valueClass = Class.forName(&quot;com.test.ValueClass&quot;);
  KafkaConsumer&lt;keyClass, valueClass&gt; consumer = new KafkaConsumer&lt;&gt;(properties);
  </code></pre>
  <p>Any pointers would be appreciated. Thanks.</p>