use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class WorkspaceFoldersChangeEvent method getAdded.
/**
* The array of added workspace folders.
*/
public List<WorkspaceFolder> getAdded() {
final JSONArray json = jsonData.getJSONArray("added");
final List<WorkspaceFolder> list = new ArrayList<>(json.length());
for (int i = 0; i < json.length(); i++) {
list.add(new WorkspaceFolder(json.getJSONObject(i)));
}
return Collections.unmodifiableList(list);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class WorkspaceFoldersChangeEvent method create.
public static WorkspaceFoldersChangeEvent create(List<WorkspaceFolder> added, List<WorkspaceFolder> removed) {
final JSONObject json = new JSONObject();
JSONArray addedJsonArr = new JSONArray();
for (WorkspaceFolder workspaceFolder : added) {
addedJsonArr.put(workspaceFolder.jsonData);
}
json.put("added", addedJsonArr);
JSONArray removedJsonArr = new JSONArray();
for (WorkspaceFolder workspaceFolder : removed) {
removedJsonArr.put(workspaceFolder.jsonData);
}
json.put("removed", removedJsonArr);
return new WorkspaceFoldersChangeEvent(json);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class UnregistrationParams method setUnregisterations.
public UnregistrationParams setUnregisterations(List<Unregistration> unregisterations) {
final JSONArray json = new JSONArray();
for (Unregistration unregistration : unregisterations) {
json.put(unregistration.jsonData);
}
jsonData.put("unregisterations", json);
return this;
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class UnregistrationParams method getUnregisterations.
public List<Unregistration> getUnregisterations() {
final JSONArray json = jsonData.getJSONArray("unregisterations");
final List<Unregistration> list = new ArrayList<>(json.length());
for (int i = 0; i < json.length(); i++) {
list.add(new Unregistration(json.getJSONObject(i)));
}
return Collections.unmodifiableList(list);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class SignatureInformation method setParameters.
public SignatureInformation setParameters(List<ParameterInformation> parameters) {
if (parameters != null) {
final JSONArray json = new JSONArray();
for (ParameterInformation parameterInformation : parameters) {
json.put(parameterInformation.jsonData);
}
jsonData.put("parameters", json);
}
return this;
}
Aggregations