Java – How to generically tell if a Java Class is a primitive type


Is there any way to take a Class and determine if it represents a primitive type (is there a solution that doesn't require specifically enumerating all the primitive types)?

NOTE: I've seen this question. I'm asking basically the opposite. I have the Class, I want to know if it's a primitive.

Best Solution

There is a method on the Class object called isPrimitive.