What I understand from the official Guava's TypeToken
wiki is we can get the return type of a method even if it is defined by a type argument. But I cannot manage to retrieve the returned type of a Method
.
If I have an instanced List<String>
, how can I do to get String.class
from the get()
method instead of E
?
I know Java does type erasure during compile-time (i.e. the type argument is not available during runtime). Maybe I'm wrong, and Guava cannot retrieve the expected type of a method from a instanced class...
Aucun commentaire:
Enregistrer un commentaire