I am trying to convert JSON String to Java Object at runtime. Is it possible?
String className = errorInfo.getClassName();
String methodName = errorInfo.getMethodName();
String requestMessage = errorInfo.getMessage();
String reference3 = errorInfo.getReference3();
try {
Class claz = Class.forName(className);
Object obj = claz.newInstance();
Class[] parameterTypes = new Class[1];
parameterTypes[0] = Class.forName(reference3).getClass();
Method method = claz.getMethod(methodName, parameterTypes);
method.invoke(obj, new
ObjectMapper().readValue(requestMessage,<I have to pass here .class reference>>));
}
catch(Exception ex)
{
}