5 Replies Latest reply on Jul 6, 2010 12:37 PM by EJP

    Passing null value to Method.invoke

      Trying to invoke a class method setter with the null value gets complicated when using reflection. How does one go about passing null to a method, when invoke() expects null to represent an argument list of length zero?

      Static code:
      Thingy t = new Thingy();

      Reflection equivalent:
      Thingy t = new Thingy();
      Method nameSetter = t.getClass().getMethod("setName", String.class);
      nameSetter.invoke(t, ????????);