Monday, September 12, 2011

JSNI to Java type conversion

Hi, I'm facing a problem when calling a Java method from a JSNI one.
The error is due to a lack of consistence between the type expected as
parameter (Java Double) and the actual value (JS int). Code snippet is
below:

//Java code
public Double toRadians(Double degrees){
return Math.PI * (degrees/180);
}

//JSNI code
public native void testValueConversion()/*-{

for (var x = 0; x <= 360; x+=10) {
(...)
var xRadians = this.@test.client::toRadians(D)(x);
(...)
}

}*-/

Is there any way of casting x variable in order to match Java method
signature, taking into account that I need to preserve Java Double
type here?
Thanks,
Jésica.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate