samedi 18 janvier 2020

Checking if the return of a method is List

I'm trying to get the return type of a method using reflection, however I don't seem to be able to check for List<String> specifically.
I did it in a very hacky way:

if (method.getGenericReturnType().getTypeName().equalsIgnoreCase("java.util.List<java.lang.String>"))

Which isn't really what I should be doing, so I was wondering if there is a better solution.





Aucun commentaire:

Enregistrer un commentaire