I have a method that accepts a com.fasterxml.jackson.core.type.TypeReference and returns an object of the referenced type, but in a certain case I want to just return a new instance of that type.
Example:
public <T> T getProperty(String property, TypeReference<T> typeReference) {
try {
return someInstanceOfReferencedType();
}
catch (IOException e) {
return ???;
}
}
How can I instantiate <T> using typeReference? I can get the Type from it, but not sure what to do from there...