Hell i would like to know how value.isObject()enter code here
in below code works.
String jsonString = "{\"key\":\"value\"}";
JSONValue value = JSONParser.parseStrict(jsonString);
JSONObject object =value.isObject();
I had same implementation of JSONValue and object in my project, by using tag
<super-source path="">
I made gwt to use my implementation instead of GWT's. But using my code I have to add a type cast mechanism for isObject() method. Here is my code:
String jsonString = "{\"key\":\"value\"}";
JSONValue value = JSONParser.parseStrict(jsonString);
JSONObject object = (JSONObject)value.isObject();
please be free to share your thoughts regarding this.
UPDATE
implementation of isObject()
in my JSONValue
and JSONObject
In JSONValue
public JsonObject isObject() {
return null;
}
In JSONObject
@Override
public JSONObject isObject() {
System.out.println("is object return this");
return this;
}
where JSONValue is a abstract class and class JSONObject extends JSONValue