本文整理了Java中elemental.json.JsonObject.getArray()
方法的一些代码示例,展示了JsonObject.getArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonObject.getArray()
方法的具体详情如下:
包路径:elemental.json.JsonObject
类名称:JsonObject
方法名:getArray
[英]Return the element (uncoerced) as a JsonArray. If the type is not an array, this can result in runtime errors.
[中]将元素(未编码)作为JsonArray返回。如果类型不是数组,则可能导致运行时错误。
代码示例来源:origin: com.vaadin/vaadin-server
public ScssCacheEntry(JsonObject json) {
css = json.getString("css");
timestamp = Long.parseLong(json.getString("timestamp"));
sourceUris = new ArrayList<>();
JsonArray uris = json.getArray("uris");
for (int i = 0; i < uris.length(); i++) {
sourceUris.add(uris.getString(i));
}
// Not set for cache entries read from disk
scssFileName = null;
}
代码示例来源:origin: com.vaadin/vaadin-server
clientToServerMessageId = -1;
invocations = json.getArray(ApplicationConstants.RPC_INVOCATIONS);
代码示例来源:origin: com.vaadin/flow-server
private static Map<LoadMode, JsonArray> popDependenciesToProcessOnServer(
JsonObject initialUIDL) {
Map<LoadMode, JsonArray> result = new EnumMap<>(LoadMode.class);
Stream.of(LoadMode.EAGER, LoadMode.INLINE).forEach(mode -> {
if (initialUIDL.hasKey(mode.name())) {
result.put(mode, initialUIDL.getArray(mode.name()));
initialUIDL.remove(mode.name());
}
});
return result;
}
代码示例来源:origin: com.vaadin/flow-maven-plugin
JsonArray fragmentFiles;
try {
fragmentFiles = fragment.getArray("files");
if (fragmentFiles == null) {
throw new IllegalStateException(String.format(
代码示例来源:origin: com.vaadin/flow-server
.getArray(bundlePath);
for (int i = 0; i < bundledFiles.length(); i++) {
importToBundle.computeIfAbsent(bundledFiles.getString(i),
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-yaml-ide
/**
* Converts json string to list of Yaml Preferences
*
* @param jsonStr The json string to turn into the list of Yaml Preferences
* @return List of Yaml Preferences
*/
private List<YamlPreference> jsonToYamlPreference(String jsonStr) {
ArrayList yamlPreferences = new ArrayList<YamlPreference>();
JsonObject parsedJson = Json.parse(jsonStr);
for (String glob : parsedJson.keys()) {
try {
JsonArray jsonArray = parsedJson.getArray(glob);
for (int arrNum = 0; arrNum < jsonArray.length(); arrNum++) {
YamlPreference newYamlPref = new YamlPreference(jsonArray.getString(arrNum), glob);
yamlPreferences.add(newYamlPref);
}
} catch (Exception e) {
LOG.debug(e.getMessage(), e);
}
}
return yamlPreferences;
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
private List<Promise<Void>> restore(
JsonObject files,
EditorPartStack editorPartStack,
Map<EditorPartPresenter, EditorPartStack> activeEditors) {
if (files.hasKey("FILES")) {
// plain
JsonArray filesArray = files.getArray("FILES");
List<Promise<Void>> promises = new ArrayList<>();
for (int i = 0; i < filesArray.length(); i++) {
JsonObject file = filesArray.getObject(i);
Promise<Void> openFile = openFile(file, editorPartStack, activeEditors);
promises.add(openFile);
}
return promises;
} else {
// split
return restoreSplit(files, editorPartStack, activeEditors);
}
}
代码示例来源:origin: com.vaadin/flow-maven-plugin
fragmentsArray = bundleConfigurationJson.getArray("fragments");
} catch (JsonException | ClassCastException e) {
throw new IllegalStateException(
代码示例来源:origin: com.googlecode.gwtquery/gwtquery
return jsonArrayToList(obj.getArray(attr), ctype, clz.isArray());
} else if (ret instanceof JsonObject) {
if (clz == Object.class) {
代码示例来源:origin: com.vaadin/hummingbird-server
private static void includeDependencies(Element head,
JsonObject initialUIDL, BootstrapContext context) {
// Extract style sheets and load them eagerly
JsonArray dependencies = initialUIDL
.getArray(DependencyList.DEPENDENCY_KEY);
if (dependencies == null || dependencies.length() == 0) {
// No dependencies at all
return;
}
Predicate<? super JsonObject> includeStyleSheets = object -> DependencyList.TYPE_STYLESHEET
.equals(object.getString(DependencyList.KEY_TYPE));
com.vaadin.hummingbird.util.JsonUtil.objectStream(dependencies)
.filter(includeStyleSheets).forEach(stylesheet -> {
Element link = head.appendElement("link");
link.attr("rel", "stylesheet");
link.attr("type", "text/css");
String url = stylesheet.getString(DependencyList.KEY_URL);
url = context.getUriResolver().resolveVaadinUri(url);
link.attr("href", url);
});
// Remove from initial UIDL
JsonArray otherDependencies = com.vaadin.hummingbird.util.JsonUtil
.objectStream(dependencies).filter(includeStyleSheets.negate())
.collect(com.vaadin.hummingbird.util.JsonUtil.asArray());
initialUIDL.put(DependencyList.DEPENDENCY_KEY, otherDependencies);
}
代码示例来源:origin: com.vaadin/flow-server
clientToServerMessageId = -1;
invocations = json.getArray(ApplicationConstants.RPC_INVOCATIONS);
代码示例来源:origin: com.vaadin/hummingbird-server
clientToServerMessageId = -1;
invocations = json.getArray(ApplicationConstants.RPC_INVOCATIONS);
代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit
JsonArray childrenItemsJson = itemJson.getArray("children");
if (childrenItemsJson != null) {
MenuContainerWidget menuContainerWidget = new MenuContainerWidget(this, menuItemWidget);
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
state.hasKey(PATH_PARAM_ID) ? state.getArray(PATH_PARAM_ID) : Json.createArray();
内容来源于网络,如有侵权,请联系作者删除!