Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用gwt/gin按程序/类绑定常量_Gwt_Constants_Gwt Gin - Fatal编程技术网

使用gwt/gin按程序/类绑定常量

使用gwt/gin按程序/类绑定常量,gwt,constants,gwt-gin,Gwt,Constants,Gwt Gin,该常量如何由程序/类与gwt/gin绑定 而不是: bindConstant.annotatedWithAString.class.toXYZ 我们需要:显然,它不能编译 bindConstant.annotatedWithAString.class.toCustomStringProvider.class 因为此常量存储在cookie/脱机存储中。您不能简单地使用bindString.class.annotatedWithAString.class.toProviderCustomString

该常量如何由程序/类与gwt/gin绑定

而不是:

bindConstant.annotatedWithAString.class.toXYZ

我们需要:显然,它不能编译

bindConstant.annotatedWithAString.class.toCustomStringProvider.class

因为此常量存储在cookie/脱机存储中。

您不能简单地使用bindString.class.annotatedWithAString.class.toProviderCustomStringProvider.class吗


如果你有一个提供者,它显然不是一个常数。

我喜欢这个想法。这个CustomStringProvider看起来像什么?呃,与您希望与bindConstant一起使用的一样?我为一组字符串使用@Provides方法,即使使用JSNI,@Provides@AString native String provideAString/*-{return$wnd.AString;}-*/;没有理由不能使用ProviderI执行此操作。请参阅不支持[error]实例绑定的错误;对于@Provides原生字符串xyzHmm,可能不相关:我将其用于GIN 1.5.0和Guice 3.0,这是我代码的真实复制/粘贴:@Provides@CurrentUser原生字符串provideUsername/*-{return$wnd.user.userName;}-*/;我不理解@CurrentUser和provideUsername,我使用的是同一个ID,@AString和ProvideString。这两个是什么?谢谢