use*_*955 3 java gwt native jsni
I am using GWT and I have created a native method that calls the method cmd_addspace in the class EverlinkedActions and it works fine for now:
private static native String execute(String functionName, Object[] vParams)/*-{
try{
@es.gwt.client.dash.actions.impl.EverlinkedActions::cmd_addspace([Ljava/lanG/Object;)(vParams);
}catch(e){
alert(e.message);
}
}-*/;
Run Code Online (Sandbox Code Playgroud)
How can i make the method name dynamic? it means instead of "cmd_addspace" i want to call the method "functionName" which its name is passed as argument in the native method.
And is their a way to make the class name also dynamic? i want to have something like that:
private static native String execute(String className, String functionName, Object[] vParams)/*-{
try{
@es.gwt.client.dash.actions.impl.className::functionName([Ljava/lanG/Object;)(vParams);
}catch(e){
alert(e.message);
}
}-*/;
Run Code Online (Sandbox Code Playgroud)
Thanks for any help
不确定你想在这里实际实现什么,但恐怕 JSNI 不会那样工作。
诸如此类的代码@es.gwt.client.dash.actions.impl.EverlinkedActions::cmd_addspace([Ljava/lanG/Object;)(vParams);需要在编译时成为完全可解析的符号,因为类和方法名称会被替换为其最小化版本。
| 归档时间: |
|
| 查看次数: |
1520 次 |
| 最近记录: |