[Method.invoke] wrapper - accessing arguments passed to user method.

Discussion in 'Java' started by Storm, Apr 30, 2004.

  1. Storm

    Storm Guest

    Dear Colleagues,

    Given the following hypothetical method,

    protected Object ExampleMethod(String OStr, int oInt, String oStr_bis ...)
    {
    // .. code ..
    }

    I can retrieve (i.e.: being in method's body and using specific code) the
    current method name, Class[] array for passed arguments. Nevertheless,
    I would like to access values of these argument in a such abstract way;
    that the following custom call would be grammatically correct:

    // String method -> ExampleMethod, Class[] objects -> java.lang.string, int ..
    // (and finally) Object[] argVal -> ????)
    this.myprocessor(method, object, argVal);

    ISSUE [!] : What should be done to create this 'argVal' variable programmatically?

    Thank you for helping...
    Storm, Apr 30, 2004
    #1
    1. Advertising

  2. Storm

    Chris Uppal Guest

    Storm wrote:

    > I can retrieve (i.e.: being in method's body and using specific code) the
    > current method name, Class[] array for passed arguments. Nevertheless,
    > I would like to access values of these argument [...]


    Unfortunately, you can't. Ideally they should be recorded in the stack trace
    of an exception (or at least of some exceptions), but they aren't.

    Which is a /real/ shame because otherwise one could do some /very/ interesting
    things with NoSuchMethodException...

    -- chris
    Chris Uppal, May 1, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dee
    Replies:
    9
    Views:
    501
    Joseph Byrns
    Apr 15, 2005
  2. Anand
    Replies:
    2
    Views:
    893
    Anand
    Sep 11, 2003
  3. Replies:
    1
    Views:
    284
    Joe Francia
    Feb 23, 2005
  4. Adam Wozniak
    Replies:
    40
    Views:
    941
    Martin Demberger
    Aug 17, 2009
  5. Shadi Rafeh
    Replies:
    0
    Views:
    159
    Shadi Rafeh
    Jun 9, 2006
Loading...

Share This Page