I’m playing around with Java’s reflection API and trying to handle some fields. Now I’m stuck with identifying the type of my fields. Strings are easy, just do myField.getType().equals(String.class)
. The same applies for other non-derived classes. But how do I check derived classes? E.g. LinkedList
as subclass of List
. I can’t find any isSubclassOf(...)
or extends(...)
method. Do I need to walk through all getSuperClass()
and find my supeclass by my own?