tags:

views:

299

answers:

2

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.

+13  A: 

There is a method on the Class object, isPrimitive.

Dan Dyer
Ah, I didn't see that. Thanks.
nathan
+6  A: 

Class.isPrimitive() will tell you the answer.

AdamC