Getting the type of a parametrized class parameter?
Posted
by GuidoMB
on Stack Overflow
See other posts from Stack Overflow
or by GuidoMB
Published on 2010-06-13T18:12:16Z
Indexed on
2010/06/13
18:22 UTC
Read the original article
Hit count: 183
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?
© Stack Overflow or respective owner