Re: Explanation on ValueProxy!
Hi Thomas,
is it possible to use ValueProxy to make serialization of 3rd party classes easier? I have a bunch of Solrj classes and I had to create DTOs and copy data to them manually.
I consider to use RequestFactory and ValueProxy for automatic mapping. Does it make sense?
Here is the SO question: http://stackoverflow.com/questions/19249000/valueproxy-to-automatically-serialize-3rd-party-objects
Regards,
Konstantin.
суббота, 18 декабря 2010 г., 11:28:12 UTC+1 пользователь Thomas Broyer написал:
-- is it possible to use ValueProxy to make serialization of 3rd party classes easier? I have a bunch of Solrj classes and I had to create DTOs and copy data to them manually.
I consider to use RequestFactory and ValueProxy for automatic mapping. Does it make sense?
Here is the SO question: http://stackoverflow.com/questions/19249000/valueproxy-to-automatically-serialize-3rd-party-objects
Regards,
Konstantin.
суббота, 18 декабря 2010 г., 11:28:12 UTC+1 пользователь Thomas Broyer написал:
An EntityProxy must have an ID and a version (getId() and getVersion() accessors on the server-side domain object, or possibly using a Locator if you can't have the getId and getVersion methods on the domain object).This allows RequestFactory to dispatch EntityProxyChange events on the EventBus (version is used to detect whether the server-side object changed, and ID is used to... identify the object so you can match things on the client-side).You can see this as a "by reference" argument passing, even though there's serialization involved to go through the wire.On the other hand, a ValueProxy is just a data transfer object (DTO). Using only ValueProxy-s, you can use RequestFactory in a way similar to GWT-RPC, with the added benefit that you don't have *.gwt.rpc files to deploy, and all the headaches that go with it when developping; the main drawback being that it doesn't support polymorphism (yet).When you send an EntityProxy to the server (for instance, to persist changes you made to it), the RequestFactoryServlet will first "find" the object from the database (or datastore or whatever you use) if it was previously retrieved from the server (i.e. it has a known ID and version, it was not created on the client in the same RequestContext) to then apply the changes by calling its setters, and finally pass it to the method you called (for instance, a "persist" method).When you send a ValueProxy however, the RequestFactoryServlet always creates a new instance of the domain object, because there's no ID that can be used to reconcile the client-side object with an existing server-side object. The ValueProxy is serialized, send through the wire, and deserialized on the other side; it never "updates" an existing server-side object.(communication from server to client is similar, when an EntityProxy is received from the server by the client, it updates a cached version of the EntityProxy with the same ID, if there's one)
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home