I have the following generic class:
public abstract class DAO<T extends Model>{
// Some attributes and methods here...
public List<String> getMethods(){
// get a list of all methods of T class
}
}
In the getMethods, as the commentary says, I want to get a list of all methods the T class has. While not using generics, I can get that by doing the following:
Class fooClass = Foo.class;
Method[] methods = fooClass.getMethods();
I've tried using:
Class tClass = T.class;
Method[] methods = tClass.getMethods();
But it didn't work.
So to sum up, my question is: how to get the Class object of the T class while using generics?
Aucun commentaire:
Enregistrer un commentaire