Primitive vs Object return Type (using Reflection)
Hi
I have a Method object and I call getReturnType() to give me the class of what it returns. I then need to see if the value returned is equal to another value or not, using .equals() preferably.
The trouble is, a lot of the time the return type is a primitive, say 'int' and so I need to be able to distinguish when to use '==' and when to use .equals(). Is there any way of making sure I always end up with an Object that I can use with .equals().
Please help!
[500 byte] By [
rgunder3] at [2007-9-26 2:47:03]

Thanks scottcoleman1973 for pointing that out - I was assuming that it would return an int so a piece of code such as
int x;
Integer y;
if (x.equals(y)) ....
would not work, but if x really comes back as an Integer that's great. I've just accidentally stumbled on the same point myself and in doing so think I've solved another problem I was having (dynamic casting) by just treating everything as an Object. Not sure if this is a good way to do it but (fingers crossed!) it seems to be holding together.
Thanks for all your replies everyone!