mardi 30 décembre 2014

How to retrieve the real type of a Generic type using Java reflection [duplicate]


This question already has an answer here:




suppose the following:



public class Dao<T> {

public Dao() {
}
}

public class Test {

public Test() {
Dao<Person> personDao = new Dao<Person>();
//Get the real type of Dao using reflection, i want to get in this case "Person"
}
}


How can I retrieve the real type of Dao using Java reflection ?






Aucun commentaire:

Enregistrer un commentaire