Discussion:
GWT JSON-B
Ahmad Bawaneh
2018-05-21 01:04:35 UTC
Permalink
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+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Nándor Előd Fekete
2018-05-20 22:50:00 UTC
Permalink
I needed portable code between client/server and polymorphism (through {
'type': 'SomeTypeIdentifier', ...other properties...}). Is there some
straightforward way to do that with jsinterop annotations?
--
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+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Ignacio Baca Moreno-Torres
2018-05-22 11:45:55 UTC
Permalink
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].
Post by Ahmad Bawaneh
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
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+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Loading...