GWT RequestFactory - 向代理类添加自定义方法?
是否可以向 GWT RequestFactory 的代理类添加方法?假设我有这个:
@ProxyFor(value = MyEntity.class)
interface MyEntityProxy extends EntityProxy {
String getData(); // got it on server side
}
GetData()
在服务器端支持,这很好。如果我想添加这样的方法该怎么办:
@ProxyFor(value = MyEntity.class)
interface MyEntityProxy extends EntityProxy {
String getData(); // got it on server side
String getDataAndAppendQwerty(); // want this one on client side
}
我想手动实现getDataAndAppendQwerty()
。它是 100% 客户端代码,问题是我应该将实现放在哪里。
Is is possible to add a method to GWT RequestFactory's proxy class? Let's say I have this:
@ProxyFor(value = MyEntity.class)
interface MyEntityProxy extends EntityProxy {
String getData(); // got it on server side
}
GetData()
is backed at server side, that's fine. What if I'd like to add a method like this:
@ProxyFor(value = MyEntity.class)
interface MyEntityProxy extends EntityProxy {
String getData(); // got it on server side
String getDataAndAppendQwerty(); // want this one on client side
}
I want to manually implement getDataAndAppendQwerty()
. It's 100% client-side code and the question is just where should I put the implementation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案是 AutoBean 类别,但它们是尚未出现在 RequestFactory 中。
The answer would be AutoBean categories, but they're not (yet) surfaced in RequestFactory.
我不知道有什么简单的方法。您可以使用包装器和委托,
但是当您从服务器取回代理对象时,您必须手动将所有代理对象包装在客户端上。
I don't know of an easy way. You could use a wrapper and delegate
but you'd have to manually wrap all your proxy objects on the client when you get them back from the server.