GWT doesn't support reflection or dynamic method invocation for performance
reasons. It has to know at compile time what method you want to invoke, so
that it can eliminate methods that it knows aren't being called.

If you describe your use-case, perhaps someone could help you with a
workaround.

--Sri


On 29 April 2010 19:20, Arinté <jamar...@gmail.com> wrote:

> I want to be able to call a method on a object dynamically.  As in:
> Method m = obj.getClass().getMethod(...);
> m.invoke(...);
>
> How would I do this on the client-side in GWT.  I was trying to do
> this:
>
> reflectiveSet(trunk.getSettings().getCustName(), "value", "grumpy");
>
>    private native void reflectiveSet(Object obj, String property,
> String value)/*-{
>        alert('o' +obj);
>        alert('p' +property);
>        alert('v' +value);
>        obj[property] = value;
>    }-*/;
>
> but that doesn't work, I get this error:
>
> com.google.gwt.core.client.JavaScriptException: (null): null
>    at
>
> com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
> 195)
>
> Would this work if I were to actually deploy the war file?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to