How to use RequestFactory: .with(propertyRefs) for composition of objects
I am newbie to GWT and I need your professional advice.
开发者_如何学JAVAMy 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.
We can use form .with("a.b","a.b.c") for hierarchical composition.
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.
精彩评论