Java Code Examples for com.google.gwt.json.client.JSONString#stringValue()
The following examples show how to use
com.google.gwt.json.client.JSONString#stringValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WaitForBuildResultCommand.java From appinventor-extensions with Apache License 2.0 | 6 votes |
private static String extractFormName(RpcResult result) { String extraString = result.getExtra(); if (extraString != null) { JSONValue extraJSONValue = JSONParser.parseStrict(extraString); JSONObject extraJSONObject = extraJSONValue.isObject(); if (extraJSONObject != null) { JSONValue formNameJSONValue = extraJSONObject.get("formName"); if (formNameJSONValue != null) { JSONString formNameJSONString = formNameJSONValue.isString(); if (formNameJSONString != null) { return formNameJSONString.stringValue(); } } } } return "Screen1"; }
Example 2
Source File: GadgetMetadata.java From swellrt with Apache License 2.0 | 5 votes |
/** * Helper function to extract a string value from given JSON object. * * @param json JSON object to extract the value from. * @param key key of the value to extract. * @return the string object extracted from JSON (can be null if the value * does not exist or is invalid. */ private static String getJsonStringValue(JSONObject json, String key) { JSONValue value = json.get(key); JSONString string = (value == null) ? null : value.isString(); if (string != null) { return string.stringValue(); } else { return null; } }
Example 3
Source File: GadgetMetadata.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Helper function to extract a string value from given JSON object. * * @param json JSON object to extract the value from. * @param key key of the value to extract. * @return the string object extracted from JSON (can be null if the value * does not exist or is invalid. */ private static String getJsonStringValue(JSONObject json, String key) { JSONValue value = json.get(key); JSONString string = (value == null) ? null : value.isString(); if (string != null) { return string.stringValue(); } else { return null; } }
Example 4
Source File: JsonTokenizer.java From proarc with GNU General Public License v3.0 | 4 votes |
public static String getString(JSONObject json, String name) { JSONValue jsonVal = json.get(name); JSONString jsonString = (jsonVal == null) ? null : jsonVal.isString(); return (jsonString == null) ? null : jsonString.stringValue(); }