For transport, you can send a Long across the wire as a String using Long.toString/Long.parseLong to serialize/deserialize. On the overlay you would then have something like:
public final Long getNr() { return Long.parseLong(getNrRaw()); } private final native String getNrRaw() { return this.nr; } On Tue, May 24, 2011 at 2:07 PM, Eugen Paraschiv <hanrisel...@gmail.com>wrote: > So essentially once you have a overlay type corresponding to a model on the > server, and the server model has a method returning a Long, there is no way > to have the overlay type return Long? > On May 24, 2011 6:38 PM, "Chris Conroy" <con...@google.com> wrote: > > Javascript cannot deal with longs properly since the VM only speaks in > terms > > of doubles. Longs are emulated in GWT: > > > http://code.google.com/p/google-web-toolkit/source/browse/trunk/#trunk%2Fdev%2Fcore%2Fsuper%2Fcom%2Fgoogle%2Fgwt%2Flang > > > > The reason this doesn't work is the compiler can only emulate the longs > you > > use in Java code. Once you drop to JSNI the compiler isn't touching your > > code, and therefore it doesn't make any sense to have a JSNI method > return a > > long. > > > > On Tue, May 24, 2011 at 5:17 AM, Eugen Paraschiv <hanrisel...@gmail.com > >wrote: > > > >> I'm having a problem with the conversion of a JSON to a JNI overlay > type. > >> The java code has to following method: > >> > >> long nr = 10l; > >> public Long getNr() { > >> > >> return nr; > >> } > >> > >> The JNI overlay type is: > >> > >> public final native Long getNr() /*-{ > >> return this.nr; > >> > >> }-*/; > >> > >> I'm avoiding operating with the long primitive in the overlay type, as > the > >> compiler doesn't allow it. The official documentation says that this is > >> inefficient but it should work. However, I'm getting: > >> > >> java.lang.IllegalArgumentException: Something other than a Java object > was returned from JSNI method > '@com.avaya.thunder.portal.client.shared.model.Customer::getNr1()': JS value > of type int, expected java.lang.Object > >> > >> at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:178) > >> > >> at > com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:271) > >> > >> I'm using GWT 2.2.0. > >> > >> Is it something I'm doing wrong? Should this work? Any help is > appreciated. > >> Thanks. > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Google Web Toolkit" group. > >> To post to this group, send email to > google-web-toolkit@googlegroups.com. > >> To unsubscribe from this group, send email to > >> google-web-toolkit+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >> http://groups.google.com/group/google-web-toolkit?hl=en. > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > > To post to this group, send email to google-web-toolkit@googlegroups.com > . > > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com. > > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to google-web-toolkit@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.