title: Specifying generic collection type param at runtime (Java Reflection)
body: <p>I'd like to get the generic type of a collection, using reflection, at runtime.</p>
  
  <p>Code (JAVA):</p>
  
  <pre><code>Field collectionObject = object.getClass().getDeclaredField(
      collectionField.getName());
  //here I compare to see if a collection
  if (Collection.class.isAssignableFrom(collectionObject.getType())) {
     // here I have to use the generic type of the collection 
     // to see if it's from a specific type - in this case Persistable
     if (Persistable.class.isAssignableFrom(GENERIC_TYPE_COLLECTION.class)) {
     }
  }
  </code></pre>
  
  <p>Is there a way of getting the generic type of the collection in java at runtime? In my case I need the .class of the collection's generic type.</p>
  
  <p>Thanks in advance!</p>