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

发布于 2024-12-21 10:27:33 字数 246 浏览 3 评论 0原文

常量如何与 gwt/gin 的程序/类绑定?

而不是:

bindConstant().annotatedWith(AString.class).to("XYZ");

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

bindConstant().annotatedWith(AString.class).to(CustomStringProvider.class);

因为这个常量存储在cookie/离线存储中。

How can the constant be bound by program/class with gwt/gin?

Instead of:

bindConstant().annotatedWith(AString.class).to("XYZ");

We need: ( Obviously, it doesn't compile )

bindConstant().annotatedWith(AString.class).to(CustomStringProvider.class);

Because this constant is stored in cookie/offline storage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忘羡 2024-12-28 10:27:33

你不能简单地bind(String.class).annotatedWith(AString.class).toProvider(CustomStringProvider.class)吗?

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

Can't you simply bind(String.class).annotatedWith(AString.class).toProvider(CustomStringProvider.class)?

If you have a provider, it's obviously not a constant.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文