如何使用 RequestFactory: .with(propertyRefs) 来组合对象
我是 GWT 的新手,我需要您的专业建议。
我的问题是如何使用 RequestFactory: .with(propertyRefs) 来实现“树”结构 当这些 propertyRefs 本身包含我想要检索的项目列表时。
一些细节:
在服务器端,我有四个域对象 A、B、C、D 的层次结构:
- A 对象包含(或者我最好说保留引用) List
- B contains List
- C contains List 。
所有提到的域对象都有其相应的代理接口AProxy、BProxy、CProxy、DProxy在客户端使用。
在客户端,我想获取所有对象的层次结构 通过一次请求 AProxy 对象,这样我就可以从使用“get”方法进行数据访问的便捷性中受益,并且不必为每个子对象、子子对象等发出循环服务器请求。
由于 规范!我应该使用某物。像 .with(“property ref”) 一样获得一级层次结构 但是如何检索以下级别的组合(在我的例子中为每个对象 B 列出列表,为每个对象 C 列出列表)。
提前致谢。
I am newbie to GWT and I need your professional advice.
My question is how to use RequestFactory: .with(propertyRefs) for kind of “tree” structures
when these propertyRefs itself contain list of items I would like to retrieve.
Some details:
On the server-side I have hierarchy of four domain objects A,B,C,D:
- A object contains (or I'd better say keep reference to) List
- B contains List
- C contains List .
All mentioned domain objects have its corresponding proxy interfaces AProxy, BProxy, CProxy, DProxy to use on the client side.
On the client side I would like to get all that hierarchy of objects
by once requesting AProxy object so I would profit from the easiness of data access using “get” methods and wouldn’t be obliged to make looping server requests for every sub-object, sub-sub-objects etc.
Due to specification! I should use smth. like .with(“property ref”) to get one level of hierarchy
but what about retrieving following levels of compositions (in my case List for every object B and List for every object C).
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们可以使用 .with("ab","abc") 形式进行分层组合。
We can use form .with("a.b","a.b.c") for hierarchical composition.
如果你想深入到你的对象树而不拔你的头发。请考虑使用易于使用的数据存储 API,例如 Objectify。 http://code.google.com/p/objectify-appengine/ 这样您将不需要每次主对象更改时都必须不断管理代理对象。您只需创建对象并确保它实现 Serialized,然后让 objectify 负责处理所有序列化/反序列化问题。我建议您使用 2.2.3 版本,它非常容易设置。其他人也很幸运地使用了推土机。祝你好运。
If you want to reach deep into your object tree without pulling your hairs out. Please consider an easy to use data store api such as Objectify. http://code.google.com/p/objectify-appengine/ This way you will not have a need for proxy objects which have to be constantly managed each time your main object changes. you just create your object and make sure it implements Serializable, and let objectify worry about handling all the serializing/deserializing issues. I'd advice you go for version 2.2.3 it is super easy to setup. Others have had luck with dozer too. Best of luck.