使用gwt/gin按程序/类绑定常量
该常量如何由程序/类与gwt/gin绑定 而不是: bindConstant.annotatedWithAString.class.toXYZ 我们需要:显然,它不能编译 bindConstant.annotatedWithAString.class.toCustomStringProvider.class 因为此常量存储在cookie/脱机存储中。您不能简单地使用bindString.class.annotatedWithAString.class.toProviderCustomStringProvider.class吗使用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
如果你有一个提供者,它显然不是一个常数。我喜欢这个想法。这个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。这两个是什么?谢谢