I want to know the class of the general type of the return method, something like this:
<T> T getEntry() { System.out.println(T.class) }
The problem is that this is not a general class, this is just a general method, so I cannot extract a generic type from a class. What I want to achieve is to know what specific type the caller requires without requiring a class, for example:
<T> T getEntry(Class<?> clazz);
Is it possible?
source share