Re: How to use JSONObject with common code shared between client and server
On 10 nov, 03:48, Kashif <kashifshaikh...@gmail.com> wrote:
> No, I don't want to use Overlays - because that forces me to have a
> DTO class that has separate implementation on client and server.
Overlay types can implement interfaces, so you could code against
interfaces to share some code between client and server, but yes it
still means having two implementations of the interface: on for the
client side (overlay type) and another for the server side (POJO).
> The whole point of using JSONObject is that I have a java API that I
> can use to marshall/unmarshall DTO objects regardless if I'm sending
> them from client to server or vice versa.
See http://code.google.com/p/google-web-toolkit/issues/detail?id=4959
and http://code.google.com/p/google-web-toolkit/issues/detail?id=2900
If com.google.gwt.json.client and org.json classes really have similar
APIs, then you could probably use <super-source> to provide an
emulation of org.json that'd use com.google.gwt.json.client
internally.
Or instead of using JSONObject directly, you could use some JSONReader
and JSONWriter (that'd still mean 2 distinct implementations for the
client side and the server side, but you've just moved the burden to 2
other classes, that moreover are shared by all your domain objects).
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home