Getting the type of a parametrized class parameter?
- by GuidoMB
I have the following class
public class MyClass<T> {
public Class<T> getDomainClass() {
GET THE CLASS OF T
}
}
I've googled this problem and all the answers I could find told me to use getGenericSuperClass(), but the problem of this method is that I must have a second class that extends MyClass and I don't want to do this. What I need is to get the parametrized type of a concrete class?