Mmm, it seems that in JavaScript it's a bit tricky to find the subtype
of an object, since typeof() returns Object for any given String,
Number, Boolean.

But, as suggested here
http://www.planetpdf.com/developer/article.asp?ContentID=testing_for_object_types_in_ja
one could use the "constructor" property and do something more
sophisticated.
So, it should be up to GWT to see, after typeof() returns Object, what
exact type is the object, whether Number, String, etc...

Does anyone know where I should submit this request?
Thanks,
Emanuel


> On Jun 8, 10:37 am, ziglionz <[email protected]> wrote:
> Hi, I've tried returning a Number type from JavaScript but GWT doesn't
> allow me to cast it to an Integer.
> It sees it as a generic Object (I guess, that's how JavaScript works):
>
>         public final native <T> T get( String property ) /*-{
>                         if( typeof(this[property]) == "number" )
>                         {
>                                 return new Number(this[property]);
>                         }
>                         else
>                         {
>                                 return this[property];
>                         }}-*/;
>
> java.lang.ClassCastException:
> com.google.gwt.core.client.JavaScriptObject$ cannot be cast to
> java.lang.Integer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to