title: Java: How to check generic class type definitions?
body: <p>The idea is to define a base class that can invoke methods defined in derrived classes, but at creation time I want to ensure, that such methods are defined exactly according to the requirements, which is that the methods take only one argument, a HashMap<code>&lt;String String</code>>.</p>
  
  <p>So far I was able with the following code to check that the method contains only one parameter and that it is of Class HashMap, but how can I check that the generic definition is <code>&lt;String, String</code>> ?</p>
  
  <pre><code>public boolean isMethodParameterValid(final Method method) {
    final Class&lt;?&gt;[] parameters = method.getParameterTypes();
    return ((parameters.length == 1) &amp;&amp; parameters[0].isAssignableFrom(HashMap.class));
  }
  </code></pre>