Tuesday, May 22, 2018

Re: GWT JSON-B

You really should try to avoid inheritance in your JsInterop DTOs. But, hehe there are always someplace where you need or are forced to use it, in that case, this is what we are currently using to get "inheritance" working in the server side and the client side using DTOs: https://gist.github.com/ibaca/89a2056a862a15c24cb93cdcff908b1f

JSON does not have inheritance, nor types (uhm actually all objects are Object...), so the visitor strategy mitigates the problem, as this is the DTO, so the transfer layer, this should not affect your server. Just use always the factories in both sides and do not continue adding complexity or at some point, you should stop using JsInterop DTOs and use an actual Java -> JSON mapper like gwt-jackson[generator|apt].

On Mon, May 21, 2018 at 3:04 AM Ahmad Bawaneh <akabme@gmail.com> wrote:
As long as you can limit your classes to jstypes - double, arrays, jsDate ...etc- this could be the right choice, but when the classes are shared with the server you might end up with JsType for each bean in the server, or you can use a lib that allows you to share the bean between the client and server.

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment