Thanks for the heads up. One additional question. I am trying to wrap a 3rd javascript library that is relying on `hasOwnProperty` to check if the object contains a specific property. As far as I can tell the @JsProperty will create a property using `defineProperty`. Is there any way how to avoid the "automatic" creation of the property (or is anything planned?) Currently my workaround is to use JSNI for those fields.
On Wednesday, July 29, 2015 at 9:11:58 PM UTC+2, Goktug Gokdogan wrote: > > > > On Tue, Jul 28, 2015 at 8:36 AM, Ümit Seren <[email protected] > <javascript:>> wrote: > >> I started to play around with JSInterop and GWT 2.8.0-SNAPSHOT. >> >> Primarily I was following these documentation: >> >> >> https://docs.google.com/document/d/1tir74SB-ZWrs-gQ8w-lOEV3oMY6u6lF2MmNivDEihZ4/edit# >> >> However I ran into some issues regarding properties that don’t follow >> Java bean style convention (i.e. xAxisParser) . >> >> According to the javaDocs on the @JsProperty annotation it should be >> possible to define properties also in this way : @JsProperty x(intx) >> which translates to this.x=y. >> > > The javadoc is not accurate, only bean convetions is supported at the > moment. > > >> However when I try this, the compiler complains that the property doesn’t >> follow Java Bean naming conventions. >> >> I found a recent post about overhaul of JsInterop’s annotations ( >> https://groups.google.com/forum/#!searchin/google-web-toolkit-contributors/annotations/google-web-toolkit-contributors/Dwdk-aEHs8Y/OvSNe6egUekJ) >> >> and that it should be possible to >> override the property name. >> >> I was curious if this is planned for the 2.8.0 release or if this will go >> into GWT 3.0 ? >> > > It is planned for 2.8 release. > > >> Currently my only workaround is to use JSNI: to set the property >> directly: >> >> @JsType >> interface MyInterface { >> @JsProperty void setTitle(String title); >> @JsProperty String getTitle(); >> >> void setXAxisParser(Callback callback); >> } >> >> public MyClass implements MyInterface { >> public String title; >> public Callback callback; >> >> @Override >> public void setTitle(String title) { >> this.title = title; >> } >> @Override >> public String getTitle() { >> return title; >> } >> @Override >> public void setXAxisParser(Callback callback)/*-{ >> this.xValueParser = callback; >> }*-/; >> } >> >> >> >> -- >> 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 [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/google-web-toolkit-contributors/64db778c-7fca-45b7-a0c8-52aae0c6968f%40googlegroups.com >> >> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/64db778c-7fca-45b7-a0c8-52aae0c6968f%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/2b5b9006-4779-46a8-95d3-b4b13853387c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
