Package com.google.gwt.json.client

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


          int iconAnchorY = 0;
          if ((value = jsMarker.get("iconAnchorY")) != null) {
            JSONNumber jsAnchorY;
            if ((jsAnchorY = value.isNumber()) != null) {
              iconAnchorY = (int) Math.round(jsAnchorY
                  .doubleValue());
            }
          }

          // do not create new one if old found (only if we want to
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

            return null;
        }
        JSONNumber number = value.isNumber();
        if ( null != number )
        {
            return new Double[] { number.doubleValue() };
        }
        JSONArray array = value.isArray();
        if ( null != array )
        {
            return new Double[] { array.get( 0 ).isNumber().doubleValue(), array.get( 1 ).isNumber().doubleValue() };
View Full Code Here

            return str.stringValue();
        }
        JSONNumber number = value.isNumber();
        if ( number != null )
        {
            return new Double( number.doubleValue() ).toString();
        }
        return null;
    }

    /**
 
View Full Code Here

    }

    protected Double getDouble( int index )
    {
        JSONNumber num = getNumber( index );
        return num == null ? null : new Double( num.doubleValue() );
    }

    protected Integer getInteger( int index )
    {
        JSONNumber num = getNumber( index );
View Full Code Here

    }

    protected Integer getInteger( int index )
    {
        JSONNumber num = getNumber( index );
        return num == null ? null : new Integer( (int) num.doubleValue() );
    }

    protected String getString( int index )
    {
        JSONValue value = get( index );
View Full Code Here

    }

    protected Double getDouble( String key )
    {
        JSONNumber num = getNumber( key );
        return num == null ? null : new Double( num.doubleValue() );
    }

    protected Integer getInteger( String key )
    {
        JSONNumber num = getNumber( key );
View Full Code Here

    }

    protected Integer getInteger( String key )
    {
        JSONNumber num = getNumber( key );
        return num == null ? null : new Integer( (int) num.doubleValue() );
    }

    protected String getString( String key )
    {
        JSONValue value = get( key );
View Full Code Here

        try {
            JSONValue v = obj.get(key);
            if (v != null) {
                JSONNumber n = v.isNumber();
                if (n != null) {
                    return (int) n.doubleValue();
                } else {
                    /*
                     * If this isn't a number, then it might be a string
                     * like "5" so we try to parse it as a number.
                     */
 
View Full Code Here

        try {
            JSONValue v = obj.get(key);
            if (v != null) {
                JSONNumber n = v.isNumber();
                if (n != null) {
                    return n.doubleValue();
                } else {
                    /*
                     * If this isn't a number, then it might be a string
                     * like "5" so we try to parse it as a number.
                     */
 
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.