aspose file tools*
The moose likes Java in General and the fly likes Reflection Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Reflection Question" Watch "Reflection Question" New topic
Author

Reflection Question

Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
When a method returns a primitive, but you invoked it from Method.invoke(...), does it return a the primitive wrapper?
example:
public boolean yes()
{
return true;
}
invoking from reflection:
(DO I HAVE TO DO THE FOLLOWING?)
( ( Boolean )meth.invoke( target, null ) ).booleanValue();
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Correct.


"I'm not back." - Bill Harding, Twister
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Simple answer: yes. Parameters passed to an invoked method need to be wrapped whenever the origninal parameter happens to be of primitive type and the same counts for the return values of reflective invokation methods. You need to unwrap them yourself.
kind regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reflection Question