GWT RequestFactory:将接口继承到RequestContext中
我有我的 OrganizationRequestContext 接口,效果很好:
@Service(OrganizationDAO.class)
public interface OrganizationRequestContext extends RequestContext
{
Request<OrganizationProxy> findOrganization(Long id);
InstanceRequest<OrganizationProxy, Void> persist();
InstanceRequest<OrganizationProxy, Void> remove();
}
现在我想将最后两个函数放入我自己设计的 PersistentRequestContext 中,这样我就可以在客户端中以相同的方式对待所有 RequestContext code:
public interface PersistableRequestContext<T extends BaseProxy>
{
InstanceRequest<T, Void> persist();
InstanceRequest<T, Void> remove();
}
...
@Service(OrganizationDAO.class)
public interface OrganizationRequestContext extends RequestContext, PersistentRequestContext<OrganizationProxy>
{
Request<OrganizationProxy> findOrganization(Long id);
}
但这验证失败:服务器抱怨
[ERROR] com.activegrade.shared.data.PersistableRequestContext is not a RequestContext
如果我让 PersistableRequestContext 扩展 RequestContext,那么服务器抱怨它没有链接到任何特定的 DAO 服务。
在我的各种 RequestContext 接口中,除了 RequestContext
之外,还有什么方法可以扩展通用接口吗?
I have my OrganizationRequestContext interface, which works great:
@Service(OrganizationDAO.class)
public interface OrganizationRequestContext extends RequestContext
{
Request<OrganizationProxy> findOrganization(Long id);
InstanceRequest<OrganizationProxy, Void> persist();
InstanceRequest<OrganizationProxy, Void> remove();
}
Now I want to take those last two functions and put them in a PersistentRequestContext
of my own design so that I can treat all of my RequestContexts the same in my client code:
public interface PersistableRequestContext<T extends BaseProxy>
{
InstanceRequest<T, Void> persist();
InstanceRequest<T, Void> remove();
}
...
@Service(OrganizationDAO.class)
public interface OrganizationRequestContext extends RequestContext, PersistentRequestContext<OrganizationProxy>
{
Request<OrganizationProxy> findOrganization(Long id);
}
But this fails validation: the server complains that
[ERROR] com.activegrade.shared.data.PersistableRequestContext is not a RequestContext
If I make PersistableRequestContext extend RequestContext, then the server complains that it is not linked to any particular DAO service.
Is there any way to extend a common interface besides RequestContext
in my various RequestContext interfaces?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此问题已在 GWT 2.4 中修复。感谢谷歌!
http://code.google.com/p/google -web-toolkit/issues/detail?id=6035
This issue has been fixed in GWT 2.4. Thanks Google!
http://code.google.com/p/google-web-toolkit/issues/detail?id=6035