This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reflection Question

 
Robert Paris
Ranch Hand
Posts: 585
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct.
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic