use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.
the class RemoteServer method executeDebugSource.
public void executeDebugSource(String fileName, ArrayList<Integer> topBreakLines, ArrayList<Integer> debugBreakLines, int step, int mode, ServerRequestCallback<TopLevelLineData> requestCallback) {
JSONArray params = new JSONArray();
params.set(0, new JSONString(fileName));
params.set(1, JSONUtils.toJSONNumberArray(topBreakLines));
params.set(2, JSONUtils.toJSONNumberArray(debugBreakLines));
params.set(3, new JSONNumber(step));
params.set(4, new JSONNumber(mode));
sendRequest(RPC_SCOPE, EXECUTE_DEBUG_SOURCE, params, requestCallback);
}
use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.
the class RemoteServer method getRmdPublishDetails.
@Override
public void getRmdPublishDetails(String target, ServerRequestCallback<RmdPublishDetails> requestCallback) {
JSONArray params = new JSONArray();
params.set(0, new JSONString(target));
sendRequest(RPC_SCOPE, GET_RMD_PUBLISH_DETAILS, params, requestCallback);
}
use of com.google.gwt.json.client.JSONString in project che by eclipse.
the class StringListUnmarshaller method toList.
public List<String> toList(String jsonStr) {
JSONValue parsed = JSONParser.parseStrict(jsonStr);
JSONArray jsonArray = parsed.isArray();
if (jsonArray == null) {
return Collections.emptyList();
}
List<String> list = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
JSONValue jsonValue = jsonArray.get(i);
JSONString jsonString = jsonValue.isString();
String stringValue = (jsonString == null) ? jsonValue.toString() : jsonString.stringValue();
list.add(stringValue);
}
return list;
}
use of com.google.gwt.json.client.JSONString in project che by eclipse.
the class JsonHelper method toMap.
public static Map<String, String> toMap(String jsonStr) {
Map<String, String> map = new HashMap<String, String>();
JSONValue parsed = JSONParser.parseStrict(jsonStr);
JSONObject jsonObj = parsed.isObject();
if (jsonObj != null) {
for (String key : jsonObj.keySet()) {
JSONValue jsonValue = jsonObj.get(key);
JSONString jsonString = jsonValue.isString();
// if the json value is a string, set the unescaped value, else set the json representation of the value
String stringValue = (jsonString == null) ? jsonValue.toString() : jsonString.stringValue();
map.put(key, stringValue);
}
}
return map;
}
use of com.google.gwt.json.client.JSONString in project rstudio by rstudio.
the class RemoteServer method sendRequest.
private <T> void sendRequest(String scope, String method, String param1, String param2, ServerRequestCallback<T> requestCallback) {
JSONArray params = new JSONArray();
// pass JSONNull if the string is null
params.set(0, param1 != null ? new JSONString(param1) : JSONNull.getInstance());
params.set(1, param2 != null ? new JSONString(param2) : JSONNull.getInstance());
sendRequest(scope, method, params, requestCallback);
}
Aggregations