I want to check whether a java.lang.reflect.Type instance represents an Emum object or not.
I can check whether it’s an instance of a specific class using == comparisons e.g:
type == String.class // works
but this doesn’t seem to work for the Enum class:
type == Enum.class // doesn't work
… this makes sense as the instance would be of a specific enum but I would like to check whether the type is for any enum or not.
Could someone explain the obvious to me of how to tell whether the Type is an enum or not please
1 Answer