GWT Dynamic loading using GWT.create() with String literals instead of Class literals

后端 未结 9 1213
一个人的身影
一个人的身影 2020-12-14 10:11

GWT.create() is the reflection equivalent in GWT, But it take only class literals, not fully qualified String for the Class name. How do i dynamically create classes with

9条回答
  •  再見小時候
    2020-12-14 10:31

    You might be able to avoid the whole issue by doing it on the server side. Say with a service witch takes String and returns some sort of a serializable super type. On the server side you can do

    return (MySerializableType)Class.forName("className").newInstance();
    

    Depending on your circumstances it might not be a big performance bottleneck.

提交回复
热议问题