All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.gwt.test.internal.patchers.JSONNumberPatcher Maven / Gradle / Ivy

There is a newer version: 0.63
Show newest version
package com.googlecode.gwt.test.internal.patchers;

import com.google.gwt.json.client.JSONNumber;
import com.googlecode.gwt.test.patchers.PatchClass;
import com.googlecode.gwt.test.patchers.PatchMethod;

@PatchClass(JSONNumber.class)
class JSONNumberPatcher {

    @PatchMethod
    static String toString(JSONNumber jsonNumber) {
        double doubleValue = jsonNumber.doubleValue();
        if (Math.floor(doubleValue) == doubleValue) {
            // the number is an integer
            return String.valueOf((int) doubleValue);
        } else {
            return String.valueOf(doubleValue);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy