dimanche 6 mai 2018

How to resolve the actual type of a generic argument of a method in Java?

For example, for classes

class Foo<T> {

   public void doSomething(T t) { ... }
}

class Bar extends Foo<String> {
}

Is there a way to tell the concrete class of the argument of doSomething in Bar during runtime through reflection?





Aucun commentaire:

Enregistrer un commentaire