A
anita1766
I'd like to be able to the Class int.class, boolean.class, etc., as the
case maybe, given an object which may or maynot be of primitive type.
I can ofcourse check if the object isPrimitive, but from what I can see
the only way to get the primitive Class type of an object is through
Integer.TYPE or Boolean.Type etc., I cannot do that because I really
dont know what kind of primitive I have and I DONT WANT to do a case
statement. I wish there was a way to cast it to an interface like
IPrimitive or something which implemented geType() or whatever.
There has to be an easy way of doing this. Seems like a very basic
requirement.
So to sum it up for those that dont read long ramblings..
I have
Object obj
I need to botain int.class, boolean.class etc., from obj in a generic
way with no comparisons to all the primitive type wrappers.
Thanks
Anita
case maybe, given an object which may or maynot be of primitive type.
I can ofcourse check if the object isPrimitive, but from what I can see
the only way to get the primitive Class type of an object is through
Integer.TYPE or Boolean.Type etc., I cannot do that because I really
dont know what kind of primitive I have and I DONT WANT to do a case
statement. I wish there was a way to cast it to an interface like
IPrimitive or something which implemented geType() or whatever.
There has to be an easy way of doing this. Seems like a very basic
requirement.
So to sum it up for those that dont read long ramblings..
I have
Object obj
I need to botain int.class, boolean.class etc., from obj in a generic
way with no comparisons to all the primitive type wrappers.
Thanks
Anita