title: Java reflection: Checking the type of the method parameter at runtime
body: <p>I need to check that the type of the method first parameter is <code>List&lt;Class&lt;? extends Exception&gt;&gt;</code> or not. Can anybody suggested better solution than comparing it with a String?</p>
  
  <pre><code>Method m = Foo.class.getMethod("m1", List.class);
  if (m.getGenericParameterTypes()[0].toString().equals("java.util.List&lt;java.lang.Class&lt;? extends java.lang.Exception&gt;&gt;")) {
    ...
  }
  </code></pre>
  
  <p>I mean something like this:</p>
  
  <pre><code>List.class.isAssignableFrom((Class&lt;?&gt;)((ParameterizedType)m.getGenericParameterTypes()[0]).getRawType()));
  </code></pre>
  
  <p>This check that it is a list or not. But how I can check the <code>Class&lt;? extends Exception&gt;</code> part of the type?</p>