Example usage for com.google.gwt.json.client JSONException JSONException

List of usage examples for com.google.gwt.json.client JSONException JSONException

Introduction

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

Prototype

public JSONException() 

Source Link

Document

Constructs a new JSONException.

Usage

From source file:com.eduworks.gwt.client.net.packet.AjaxPacket.java

License:Apache License

public void put(String key, Object jsonValue) {
    if (jsonValue instanceof String)
        super.put(key, new JSONString((String) jsonValue));
    else if (jsonValue instanceof Number)
        super.put(key, new JSONNumber(Double.parseDouble(String.valueOf(jsonValue))));
    else if (jsonValue instanceof JSONArray)
        super.put(key, (JSONArray) jsonValue);
    else if (jsonValue instanceof JSONObject)
        super.put(key, (JSONObject) jsonValue);
    else if (jsonValue instanceof Boolean)
        super.put(key, JSONBoolean.getInstance((Boolean) jsonValue));
    else if (jsonValue == null)
        super.put(key, (JSONNull) jsonValue);
    else//from ww  w.  jav a 2  s  .c o m
        throw new JSONException();
}