I am trying to determine the class type of a class using reflection and then do something specific. For example, if the class is a double, use a double specific method.
I am attempting to use
if(f.getClass() == Double.class)
However, I am getting a compiler error:
"Incompatible operand types Class <capture#1-of ? extends Field> and Class<Double>"
What is the proper way to do this?
Edit: to be more clear
f is of type Field. obtained by reflection in a loop
(Field f : instance.getDeclaredFields())