in sdk-java/src/main/java/com/spotify/confidence/ConfidenceTypeMapper.java [88:104]
public static ConfidenceValue from(Struct struct, StructFlagSchema schema) {
final Map<String, ConfidenceValue> map =
struct.getFieldsMap().entrySet().stream()
.collect(
Collectors.toMap(
Map.Entry::getKey,
entry -> {
if (schema.getSchemaMap().containsKey(entry.getKey())) {
return from(entry.getValue(), schema.getSchemaMap().get(entry.getKey()));
} else {
throw new ParseError(
String.format("Lacking schema for field '%s'", entry.getKey()));
}
}));
return ConfidenceValue.Struct.ofMap(map);
}