I want to go from a TypeReference<E>
object to a Class<E>
object in Java, without using casting. I require the usage of TypeReference
because of the way my code uses Jackson and I need Class
object because I want to use it to infer a type into one of my other Generic Classes in my app.
I know that TypeReference.getType()
will return a java.lang.reflect.Type object. Basically, if I can find out a way to use code without casting to get from Type
to Class
, then I have figured out my problem.
Javadoc References: