use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class TypeDefinitionRegistrationOptions method setDocumentSelector.
public TypeDefinitionRegistrationOptions setDocumentSelector(List<Object> documentSelector) {
if (documentSelector != null) {
final JSONArray json = new JSONArray();
for (Object object : documentSelector) {
if (object instanceof DocumentFilter) {
json.put(((DocumentFilter) object).jsonData);
} else {
json.put(object);
}
}
jsonData.put("documentSelector", json);
} else {
jsonData.put("documentSelector", JSONObject.NULL);
}
return this;
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class UnregistrationParams method create.
public static UnregistrationParams create(List<Unregistration> unregisterations) {
final JSONObject json = new JSONObject();
JSONArray unregisterationsJsonArr = new JSONArray();
for (Unregistration unregistration : unregisterations) {
unregisterationsJsonArr.put(unregistration.jsonData);
}
json.put("unregisterations", unregisterationsJsonArr);
return new UnregistrationParams(json);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class WorkspaceFoldersChangeEvent method setAdded.
public WorkspaceFoldersChangeEvent setAdded(List<WorkspaceFolder> added) {
final JSONArray json = new JSONArray();
for (WorkspaceFolder workspaceFolder : added) {
json.put(workspaceFolder.jsonData);
}
jsonData.put("added", json);
return this;
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class WorkspaceFoldersChangeEvent method setRemoved.
public WorkspaceFoldersChangeEvent setRemoved(List<WorkspaceFolder> removed) {
final JSONArray json = new JSONArray();
for (WorkspaceFolder workspaceFolder : removed) {
json.put(workspaceFolder.jsonData);
}
jsonData.put("removed", json);
return this;
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class WorkspaceFoldersChangeEvent method getRemoved.
/**
* The array of the removed workspace folders.
*/
public List<WorkspaceFolder> getRemoved() {
final JSONArray json = jsonData.getJSONArray("removed");
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);
}
Aggregations