mercredi 13 novembre 2019

how to get generic output type of a method with reflection

I have below code in order to get return type of a method:

Class<?> c = classLoader.loadClass("com.simpleTest");
Method declaredMethods = c.getDeclaredMethods("Test");
Class<?> returnType = selectedMethod.getReturnType();

sometimes my return type is instance of a collection or a map and i want to know the generic types of it. how can i obtain it?





Aucun commentaire:

Enregistrer un commentaire