Package com.google.gwt.json.client

Examples of com.google.gwt.json.client.JSONNumber.doubleValue()


        if (null == s)
        {
            ctx.addBadTypeError("Number");
        }
        if (false == isNumber(s.doubleValue()))
        {
            ctx.addBadTypeError("Number");
        }
    }
View Full Code Here


public class Utils {
  public static int extractId(JSONValue a_Value){
    JSONNumber jn = a_Value.isNumber();
    if (jn != null){
      return (int) jn.doubleValue();
    }
    else{
      String val = a_Value.isString().stringValue();
      return Integer.parseInt(val);
    }
View Full Code Here

   */
  private static Long getJsonLongValue(JSONObject json, String key) {
    JSONValue value = json.get(key);
    JSONNumber number = (value == null) ? null : value.isNumber();
    if (number != null) {
      return Math.round(number.doubleValue());
    } else {
      return null;
    }
  }

View Full Code Here

    if (value == null)
      return null;
    JSONNumber v = value.isNumber();
    if (v == null)
      return null;
    return new Double(v.doubleValue());
  }
 
  public static Boolean getJsonBoolean(JSONObject object, String key) {
    JSONValue value = object.get(key);
    if(value == null)
View Full Code Here

        assert value != null;
        if ((string = value.isString()) != null) {
            return string.stringValue();
        }
        if ((number = value.isNumber()) != null) {
            double doubleValue = number.doubleValue();
            if (doubleValue == (int) doubleValue) {
                return Integer.toString((int) doubleValue);
            }
            return Double.toString(doubleValue);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.