Detecting the generic type in runtime

Assuming we have a class:


public abstract class GenericDAOImpl


Now what if we need to get the "Class" object identifying the generic type's class type in run time ?


Class entityClass = (Class)((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];


Kindly share if there are other ways.

Comments

Popular posts from this blog

Testing SOAP services using pingdom