--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/4d08f88c-ec88-4818-b778-3e0e247f2e7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The adapter class adds overhead though and you need to convert into and out of it every time you pass it to JS. At that point you may as well use Java.util.List and write an adapter around JS array.
On Mon, May 8, 2017 at 7:10 AM Jens <jens.ne...@gmail.com> wrote:
IMHO if you want a JavaScript array, set, map behave the same as a Java collection, so you can use it with other libraries, you should write an adapter class that implements the Java API and operates internally on the JavaScript data type.--Basically do not rely on invisible magic. That could easily be implemented as a 3rd party project.-- J.
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
Basically what we need it for is REST. Currently we use AutoBeans, but we want to change it because we need to pass the model to JS too; secondly AutoBeans generate a lot of code. We would like to still preserve shared model with the server. So, JsInterop seems the most natural choice, except it doesn't support collections. We mostly need List and Map. Switching to JsInterop with replacing Lists with some JS array view would be quite an effort. It would introduce that into our server logic too (by the shared model). And and you could even use Java's for each loop, as native JsType cannot extend non-JsType interfaces, so it could not extend Iterable (of course adapter could be instantiated for every list you want to iterate). Same for streams.Therefore we look for collection support in JsInterop, which was planned for "phase 2". If that was in our reach, we could help in getting it.
Marcin
On Monday, 8 May 2017 16:42:17 UTC+2, Ray Cromwell wrote:
The adapter class adds overhead though and you need to convert into and out of it every time you pass it to JS. At that point you may as well use Java.util.List and write an adapter around JS array.
On Mon, May 8, 2017 at 7:10 AM Jens <jens.ne...@gmail.com> wrote:
IMHO if you want a JavaScript array, set, map behave the same as a Java collection, so you can use it with other libraries, you should write an adapter class that implements the Java API and operates internally on the JavaScript data type.--Basically do not rely on invisible magic. That could easily be implemented as a 3rd party project.-- J.
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/4d08f88c-ec88-4818-b778-3e0e247f2e7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/5e9868cd-35d6-4f48-81b8-ef26ff791906%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/5e9868cd-35d6-4f48-81b8-ef26ff791906%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAM28XAsesxqBxAS9Pjov%3DfPqy_u2raCEmFWLsO6OZN%3DbDrcpqA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAM28XAsesxqBxAS9Pjov%3DfPqy_u2raCEmFWLsO6OZN%3DbDrcpqA%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "GWT Contributors" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit-contributors/Be2m_AnyL_g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA1BE9gw6700%3Dia5Lq-2kOPahesOcX9SGcQSFvKrbO_mtw%40mail.gmail.com.
I believe it was in plans with @JsConvert – see slides 67 – 69. https://docs.google.com/file/d/0ByS1wxINeBWjeGYxbkJpamxFZ28/edit
In short I would like JS arrays to be visible in GWT as a List and objects parsed from JSON also as a Map.
Maybe I'll try one more time to explain what we have. We share model between server and GWT in form of java interfaces. Those interfaces are declared as return types of Jersey services, which serve instances of those interfaces. GWT uses exactly the same interfaces and handles them with AutoBeans. It works quite well, but there are two issues. First issue is that occasionally we need to pass some part of the data to JS. More often than not, it is a list or contains a list. As a result, we need to repackage it, as GWT objects are not understood by JS. Now we plan to leverage more JS, so we will have to deal with this problem more often. Second issue is that AutoBeans turned out to be inefficient in larger scale, as the generated code is roughly 50% of our written code.
So, we came up with following idea: let’s keep shared interfaces, just annotate them with @JsType(native=true). Then use regular browser’s JSON parser and cast parsed object into model interface with @JsType. It works like charm for simple objects, but not for collections - List is being parsed as an JS array; Map is nothing else but just regular object. Dropping support for java collections, would be very expensive, and would require heavy refactoring, as the app is big (over 0.5 million Java lines in GWT + affected server parts). I thought there could be a way to tell JsInterop that specific field is backed by a plain array (or list) and an object (for map).
There is indeed something in it. Actually you could have some type of naming convention, like in TJSON (https://tonyarcieri.com/introducing-tjson-a-stricter-typed-form-of-json) or TypedJson (https://www.npmjs.com/package/typed-json) to figure out proper types. But then I would need to create eg. ArrayList with the Manuel's trick (the asList() from Polymer). I'll test it.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/95e1bd43-b4a6-4b2d-bd89-6cc6fb206631%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/95e1bd43-b4a6-4b2d-bd89-6cc6fb206631%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA0Wr0pWKUcqyN2YMkuoZZK7b3e-ipm7jqv2DdDeqk8sMA%40mail.gmail.com.
@JsType(isNative=true, name="Array", namespace=JsPackage.GLOBAL)public class JsArray<E> {// JS method declarations here, but can be also empty}
@JsTypepublic class JsArrayList<E> extends JsArray<E> implements List<E> {// List implementation here}
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/95e1bd43-b4a6-4b2d-bd89-6cc6fb206631%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/95e1bd43-b4a6-4b2d-bd89-6cc6fb206631%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA0Wr0pWKUcqyN2YMkuoZZK7b3e-ipm7jqv2DdDeqk8sMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/651f6423-853c-4c25-9b92-86d8ab711067%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/95e1bd43-b4a6-4b2d-bd89-6cc6fb206631%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA0Wr0pWKUcqyN2YMkuoZZK7b3e-ipm7jqv2DdDeqk8sMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/95e1bd43-b4a6-4b2d-bd89-6cc6fb206631%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA0Wr0pWKUcqyN2YMkuoZZK7b3e-ipm7jqv2DdDeqk8sMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/651f6423-853c-4c25-9b92-86d8ab711067%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/dfe8b1da-5547-4fb4-812b-73c8f14257a3%40googlegroups.com.