use of org.openlca.jsonld.Json in project olca-modules by GreenDelta.
the class ImpactMethodImport method mapNwSets.
private void mapNwSets(JsonObject json, ImpactMethod method) {
var array = Json.getArray(json, "nwSets");
if (array == null)
return;
for (JsonElement e : array) {
if (!e.isJsonObject())
continue;
var nwObj = e.getAsJsonObject();
var nwSet = new NwSet();
method.nwSets.add(nwSet);
In.mapAtts(nwObj, nwSet, 0L);
nwSet.weightedScoreUnit = Json.getString(json, "weightedScoreUnit");
Json.stream(Json.getArray(nwObj, "factors")).filter(JsonElement::isJsonObject).map(f -> nwFactor(f.getAsJsonObject(), method)).forEach(nwSet.factors::add);
}
}
Aggregations