Example usage for com.google.gwt.json.client JSONNumber getValue

List of usage examples for com.google.gwt.json.client JSONNumber getValue

Introduction

In this page you can find the example usage for com.google.gwt.json.client JSONNumber getValue.

Prototype

@Deprecated
public double getValue() 

Source Link

Document

Gets the double value this JSONNumber represents.

Usage

From source file:rocket.json.client.JsonSerializer.java

License:Apache License

/**
 * Null safe method to retrieve the double value from a jsonValue which may
 * or may not be a JSONNumber. If its null or not a JSONNumber 0 is
 * returned.//from  ww  w  . j a va  2s .  c  o m
 * 
 * @param jsonValue
 * @return
 */
double readDouble(final JSONValue jsonValue) {
    double value = 0;

    while (true) {
        if (null == jsonValue) {
            break;
        }
        final JSONNumber number = jsonValue.isNumber();
        if (null == number) {
            break;
        }

        value = number.getValue();
        break;
    }

    return value;
}