dimanche 28 juin 2015

How to get main type of generic field with reflection in java?

Assume that i have these below classes in my project:

public class MyBaseEntity<T> {
    T   id;
}

public class MySubClass extends MyBaseEntity<Long> {

}

and now, i want to get main type of id(java.lang.Long) field of MySubClasswith java reflection, how can i do that?





Aucun commentaire:

Enregistrer un commentaire