Re: JSONNumber getValue() and ints

2008-10-01 Thread Reinier Zwitserloot

I'm working a JSON library that is a lot nicer and just has an asInt()
method, by the way.

Should show up in the incubator soon.

On Oct 1, 7:30 pm, "Seven Reeds" <[EMAIL PROTECTED]> wrote:
> Oh!  feh, I had googled "gwt JSONNumber".  The class ref that came
> back was the 1.4 doc version.  1.5 is very different it seems.
>
> thanks for everyone's help
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: JSONNumber getValue() and ints

2008-10-01 Thread Seven Reeds

Oh!  feh, I had googled "gwt JSONNumber".  The class ref that came
back was the 1.4 doc version.  1.5 is very different it seems.

thanks for everyone's help

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: JSONNumber getValue() and ints

2008-10-01 Thread Alex Rice

Seven, I am seeing it in the Javadoc (GWT API Reference) for
com.google.gwt.json.client.JSONNumber.



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: JSONNumber getValue() and ints

2008-10-01 Thread Seven Reeds

> Use doubleValue() and then cast to int. All JavaScript numbers (and
> therefore all JSONNumbers) are really doubles.

This worked like a charm.  Thank you.

Silly question, where is doubleValue() defined?  I am not seeing it in
the JSON or Double docs.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: JSONNumber getValue() and ints

2008-09-30 Thread Alex Rice

Got it! thanks

On Sep 30, 2:52 pm, "Perelman Nathan (Nathan)"
<[EMAIL PROTECTED]> wrote:
> Use doubleValue() and then cast to int. All JavaScript numbers (and
> therefore all JSONNumbers) are really doubles.
>
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: JSONNumber getValue() and ints

2008-09-30 Thread Alex Rice

A very good question, because there is a doubleValue() but no
intValue() ... Hmm,

On Sep 30, 2:43 pm, "seven.reeds" <[EMAIL PROTECTED]> wrote:
> Hi
>
> I am using Eclipse 3.4.1, java 1.6.0_07, gwt 1.5.2 under linux.
>
> I have a JSON object that contains an integer value.  I am trying the
> following to get it:
>
> int rowCount =
> index.Info.get("RowCount").isNumber().getValue().intValue();
>
> Eclipse tells me the getValue() for JSONNumber is depreciated
>
> Is there a better way?



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



RE: JSONNumber getValue() and ints

2008-09-30 Thread Perelman Nathan (Nathan)

Use doubleValue() and then cast to int. All JavaScript numbers (and
therefore all JSONNumbers) are really doubles.

-Original Message-
From: Google-Web-Toolkit@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of seven.reeds
Sent: Tuesday, September 30, 2008 16:43
To: Google Web Toolkit
Subject: JSONNumber getValue() and ints


Hi

I am using Eclipse 3.4.1, java 1.6.0_07, gwt 1.5.2 under linux.

I have a JSON object that contains an integer value.  I am trying the
following to get it:

int rowCount =
index.Info.get("RowCount").isNumber().getValue().intValue();

Eclipse tells me the getValue() for JSONNumber is depreciated

Is there a better way?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---