JsonArray reduceArray = minimizeJson.get("reduce").asArray(); for (JsonValue reduce : reduceArray) { String path = reduce.asObject().get("archive").asString(); JsonArray removeArray = reduce.asObject().get("paths").asArray(); for (JsonValue remove : removeArray) { File removeFile = new File(fileNoExt, remove.asString()); JsonArray removeArray = minimizeJson.get("remove").asArray(); for (JsonValue remove : removeArray) { String platform = remove.asObject().get("platform").asString(); JsonArray removeFilesArray = remove.asObject().get("paths").asArray(); for (JsonValue removeFile : removeFilesArray) { removeFileWildcard(output, removeFile.asString(), config);
classpath = toStringArray(json.get("classpath").asArray()); removePlatformLibs = toStringArray(json.get("removelibs").asArray()); List<String> vmArgs = toStringArray(json.get("vmargs").asArray()); this.vmArgs = new ArrayList<>(); for (String vmArg : vmArgs) { resources = toFileArray(json.get("resources").asArray());
/** * Reads a JSON array from the given string. * * @param string * the string that contains the JSON array * @return the JSON array that has been read * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array * @deprecated Use {@link Json#parse(String)}{@link JsonValue#asArray() .asArray()} instead */ @Deprecated public static JsonArray readFrom(String string) { return JsonValue.readFrom(string).asArray(); }
/** * Reads a JSON array from the given reader. * <p> * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in * an additional <code>BufferedReader</code> does <strong>not</strong> improve reading * performance. * </p> * * @param reader * the reader to read the JSON array from * @return the JSON array that has been read * @throws IOException * if an I/O error occurs in the reader * @throws ParseException * if the input is not valid JSON * @throws UnsupportedOperationException * if the input does not contain a JSON array * @deprecated Use {@link Json#parse(Reader)}{@link JsonValue#asArray() .asArray()} instead */ @Deprecated public static JsonArray readFrom(Reader reader) throws IOException { return JsonValue.readFrom(reader).asArray(); }
private static JsonArray extractMeasurements(JsonObject caliperResults) { JsonArray result = new JsonArray(); JsonArray measurements = caliperResults.get("run").asObject().get("measurements").asArray(); for (JsonValue measurement : measurements) { result.add(extractMeasurement(measurement.asObject())); } return result; }
private static JsonObject extractMeasurement(JsonObject measurement) { JsonObject times = measurement.get("v").asObject() .get("measurementSetMap").asObject() .get("TIME").asObject(); return new JsonObject().add("variables", measurement.get("k").asObject().get("variables")) .add("units", times.get("unitNames")) .add("values", extractTimes(times.get("measurements").asArray())); }
private List<String> toListOfString(JsonValue value) { Iterable<JsonValue> valueIterable = () -> value.asArray().iterator(); return StreamSupport.stream(valueIterable.spliterator(), false) .map(element -> element.asString()) .collect(Collectors.toList()); }
public JsonArray getAsJsonArray(final String field){ JsonValue value = getAsJsonValue(field); if (value == null || value.isNull()) { return null; } return value.asArray(); }
@SuppressWarnings("unchecked") @Override public T[] read(JsonValue jsonValue) throws Exception { JsonArray array = jsonValue.asArray(); T[] result = (T[]) Array.newInstance(clazz, array.size()); for (int i = 0; i < result.length; i++) { result[i] = getValue(array.get(i)); } return result; }
public List<GeneratorTarget> getGeneratorTargets() { List<GeneratorTarget> references = new ArrayList<>(); json.get("generatorTargets").asArray().forEach(ref -> { //JsonObject atts = ref.asObject(); references.add(new GeneratorTarget(ref.asString())); }); return references; }
public List<GeneratorTarget> getGeneratorTargets() { List<GeneratorTarget> references = new ArrayList<>(); json.get("generatorTargets").asArray().forEach(ref -> { //JsonObject atts = ref.asObject(); references.add(new GeneratorTarget(ref.asString())); }); return references; }
@SuppressWarnings({"unchecked", "rawtypes"}) public FractionListParser(InputStream fractionListJson, InputStream packageSpecStream) throws IOException { try (InputStreamReader reader = new InputStreamReader(fractionListJson)) { Json.parse(reader).asArray().forEach(entry -> { JsonObject fraction = entry.asObject(); FractionDescriptor fd = getFractionDescriptor(fraction); addDependencies(fraction, fd); }); } packageSpecs.putAll((Map) PropertiesUtil.loadProperties(packageSpecStream)); }
private List<BoxFolder> parsePathCollection(JsonObject jsonObject) { int count = jsonObject.get("total_count").asInt(); List<BoxFolder> pathCollection = new ArrayList<BoxFolder>(count); JsonArray entries = jsonObject.get("entries").asArray(); for (JsonValue value : entries) { JsonObject entry = value.asObject(); BoxFolder folder = new BoxFolder(); folder.createFromJson(entry); pathCollection.add(folder); } return pathCollection; }
@SuppressWarnings({"unchecked", "rawtypes"}) public FractionListParser(InputStream fractionListJson) throws IOException { try (InputStreamReader reader = new InputStreamReader(fractionListJson)) { Json.parse(reader).asArray().forEach(entry -> { JsonObject fraction = entry.asObject(); FractionDescriptor fd = getFractionDescriptor(fraction); addDependencies(fraction, fd); }); } }
@SuppressWarnings({"unchecked", "rawtypes"}) public FractionListParser(InputStream fractionListJson) throws IOException { try (InputStreamReader reader = new InputStreamReader(fractionListJson)) { Json.parse(reader).asArray().forEach(entry -> { JsonObject fraction = entry.asObject(); FractionDescriptor fd = getFractionDescriptor(fraction); addDependencies(fraction, fd); }); } }
EventLog(BoxAPIConnection api, JsonObject json, String streamPosition, int limit) { this.streamPosition = streamPosition; this.limit = limit; this.nextStreamPosition = json.get("next_stream_position").asString(); this.chunkSize = json.get("chunk_size").asInt(); this.set = new LinkedHashSet<BoxEvent>(this.chunkSize); JsonArray entries = json.get("entries").asArray(); for (JsonValue entry : entries) { this.set.add(new BoxEvent(api, entry.asObject())); } }
private List<BoxFolder.Info> parsePathCollection(JsonObject jsonObject) { int count = jsonObject.get("total_count").asInt(); List<BoxFolder.Info> pathCollection = new ArrayList<BoxFolder.Info>(count); JsonArray entries = jsonObject.get("entries").asArray(); for (JsonValue value : entries) { JsonObject entry = value.asObject(); String id = entry.get("id").asString(); BoxFolder folder = new BoxFolder(getAPI(), id); pathCollection.add(folder.new Info(entry)); } return pathCollection; }
private void addDependencies(JsonObject fraction, FractionDescriptor parent) { fraction.get("fractionDependencies").asArray().forEach(entry -> { JsonObject dependency = entry.asObject(); FractionDescriptor descriptor = getFractionDescriptor(dependency); if (parent != null) { parent.addDependency(descriptor); } addDependencies(dependency, descriptor); }); }
private void addDependencies(JsonObject fraction, FractionDescriptor parent) { fraction.get("fractionDependencies").asArray().forEach(entry -> { JsonObject dependency = entry.asObject(); FractionDescriptor descriptor = getFractionDescriptor(dependency); if (parent != null) { parent.addDependency(descriptor); } addDependencies(dependency, descriptor); }); }
private JsonArray toJsonArray(RequestLimitRule rule) { return Json.array().asArray() .add(rule.getDurationSeconds()) .add(rule.getLimit()) .add(rule.getPrecision()); } }