Wednesday, August 14, 2019

Re: elemental2: Native maps with primitive types?



On Thu, Aug 15, 2019 at 4:28 PM Vassilis Virvilis <vasvir2@gmail.com> wrote:
I have seen the @DoNotAutoBox and I tried with Integer, Number, JsNumber.

Note: I can put int in the JsPropertyMap but I cannot read it back. So
I cast it to (double) and the then to (int). I believe that is because
JavaScript does not have int type.

That is certainly an option but in some circumstances can lead to type issues when casting. I tend to prefer using Any to do these sorts of conversions. It is a little more verbose but it avoids any unexpected casting problems. I don't have the code in front of me but I believe there is a method like getAsAny("myprop") that works in this scenario
 

--
Vassilis Virvilis

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CAKbOjEzHuG5ZC7igRyvzrkLt26qBWkxNUeuWL%2BZNbKCo%2BcShgA%40mail.gmail.com.


--
Cheers,

Peter Donald

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CACiKNc6CpmL2naFFydC%2BYS%3Dmtj3yQFsQ2KojGQCRAXXSRCYhLg%40mail.gmail.com.

No comments:

Post a Comment