Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

invoke question

  Asked By: Craig    Date: Dec 23    Category: Java    Views: 492
  

I need to invoke a method dynamically. The arguments do not need to contain
values, I only need to invoke the method with defaults. I know that I can
use null for object params but what can I use for primitives?

methodName.invoke(obj,new Object[]{methodArgs});

If the method takes (Object,Object,int) I can pass (null,null,0). I want to
avoid interrogating the params and pragmatically choosing a default, is
there another safety net I can use like null for objects.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on invoke question Or get search suggestion and latest updates.




Tagged: