use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class ShowMessageRequestParams method setActions.
public ShowMessageRequestParams setActions(List<MessageActionItem> actions) {
if (actions != null) {
final JSONArray json = new JSONArray();
for (MessageActionItem messageActionItem : actions) {
json.put(messageActionItem.jsonData);
}
jsonData.put("actions", json);
}
return this;
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class TextDocumentRegistrationOptions method setDocumentSelector.
public TextDocumentRegistrationOptions 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 TextDocumentRegistrationOptions method getDocumentSelector.
/**
* A document selector to identify the scope of the registration. If set to null the document
* selector provided on the client side will be used.
*/
public List<Object> getDocumentSelector() {
final JSONArray json = jsonData.optJSONArray("documentSelector");
if (json == null) {
return null;
}
final List<Object> list = new ArrayList<>(json.length());
for (int i = 0; i < json.length(); i++) {
Object obj = json.get(i);
if (obj instanceof JSONObject) {
list.add(new DocumentFilter((JSONObject) obj));
}
list.add(obj);
}
return Collections.unmodifiableList(list);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class TerminateThreadsArguments method getThreadIds.
/**
* Ids of threads to be terminated.
*/
public List<Integer> getThreadIds() {
final JSONArray json = jsonData.optJSONArray("threadIds");
if (json == null) {
return null;
}
final List<Integer> list = new ArrayList<>(json.length());
for (int i = 0; i < json.length(); i++) {
list.add(json.getInt(i));
}
return Collections.unmodifiableList(list);
}
use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.
the class TerminateThreadsArguments method setThreadIds.
public TerminateThreadsArguments setThreadIds(List<Integer> threadIds) {
if (threadIds != null) {
final JSONArray json = new JSONArray();
for (int intValue : threadIds) {
json.put(intValue);
}
jsonData.put("threadIds", json);
}
return this;
}
Aggregations