Lets say i have an Interface GenericInterface
interface GenericInterface<T> {
T get();
}
Now, for example, if I want to obtain a Class object of the type Class<GenericInterface<String>>, like this:
public class Main {
public static void main(String[] args) {
Class<GenericInterface<String>> aClass = ...
}
}
how would I go about doing that? GenericInterface<String>.class doesn't work, and GenericInterface.class only returns a Class<GenericInterface>, without the type parameter. Class.forName("GenericInterface<java.lang.String>") also just throws a ClassNotFoundException. Is it even possible to obtain such an object?
Aucun commentaire:
Enregistrer un commentaire