title: How to Find the generic type of a class and cast a value to that type?
body: <p>In a third-party code there is the following function: </p>
  
  <pre><code>public &lt;F extends OFValueType&lt;F&gt;&gt; Builder setExact(MatchField&lt;F&gt; field, F value) throws UnsupportedOperationException;
  </code></pre>
  
  <p>Now, given a   <code>MatchField&lt;F&gt; field</code> variable, how can I find the type "F" of that variable. So that, I can cast a given value to type "F" and send the casted value to the function setExact();</p>