I use reflection to call a method like:
method.invoke(someObject, null);
The problem is that I want to use the value returned by this method, without this data type being known in advance. I know the data type in a string variable, let's say
String type = "String";
Is it possible to do something equivalent to this -
type variable = method.invoke(someObject, null)
source
share