GWT RequestFactory 是否支持扩展 RequestContext 的接口?

发布于 2024-12-01 21:31:55 字数 1207 浏览 3 评论 0原文

我的许多服务都只是暴露在 DAO 中。因此,我为这些服务创建了一个接口:

public interface DAORequestContext<T extends SRSProxyBase> extends RequestContext {
    Request<T> find(Long id);

    Request<T> load(Long id);

    Request<T> save(T id);
}

但是,当扩展此接口时(在我的 RequestFactory 中没有注释):

public interface SafeRideRequestFactory extends RequestFactory {
    public UserService userService();

    @Service(value = UserDAO.class, locator = DAOServiceLocator.class)
    interface UserService extends DAORequestContext<SRSUserProxy> { }
}

我收到运行时异常:

[ERROR] org.saferide.shared.service.DAORequestContext has no mapping to a domain type (e.g. @ProxyFor or @Service)
[ERROR] The type org.saferide.shared.service.DAORequestContext must be annotated with a @Service or @ServiceName annotation
[ERROR] The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation
[ERROR] Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation

仅允许 RequestContext 的直接后代吗?有人遇到过这个吗?

Many of my services are just exposed DAO's. So I created an interface for these services:

public interface DAORequestContext<T extends SRSProxyBase> extends RequestContext {
    Request<T> find(Long id);

    Request<T> load(Long id);

    Request<T> save(T id);
}

However when extend this interface (without annotations in my RequestFactory):

public interface SafeRideRequestFactory extends RequestFactory {
    public UserService userService();

    @Service(value = UserDAO.class, locator = DAOServiceLocator.class)
    interface UserService extends DAORequestContext<SRSUserProxy> { }
}

I get runtime exceptions:

[ERROR] org.saferide.shared.service.DAORequestContext has no mapping to a domain type (e.g. @ProxyFor or @Service)
[ERROR] The type org.saferide.shared.service.DAORequestContext must be annotated with a @Service or @ServiceName annotation
[ERROR] The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation
[ERROR] Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation

Are only direct descendants of RequestContext allowed? Has anybody run into this?

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

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

发布评论

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

评论(1

新雨望断虹 2024-12-08 21:31:55

请参阅 http://code.google.com/p/ google-web-toolkit/issues/detail?id=5807 及相关http://code.google.com/p/google-web-toolkit/issues/detail?id=6234http://code.google.com/p/google-web-toolkit/issues/detail?id=6035

这确实取决于关于您正在使用的 GWT 版本,它仍在改进中。您最好在发布时使用 GWT 2.4(此外,“验证”将在编译时而不是运行时完成)

See http://code.google.com/p/google-web-toolkit/issues/detail?id=5807 and related http://code.google.com/p/google-web-toolkit/issues/detail?id=6234 and http://code.google.com/p/google-web-toolkit/issues/detail?id=6035

It really depends on the version of GWT you're using and it's still being improved. You'd better use GWT 2.4 when it's released (where, in addition, that "validation" will be done at compile-time rather than runtime)

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