public static Value from()

in openfeature-provider/src/main/java/com/spotify/confidence/OpenFeatureTypeMapper.java [87:103]


  public static Value from(Struct struct, StructFlagSchema schema) {
    final Map<String, Value> 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 new Value(new MutableStructure(map));
  }