public Value deserialize()

in src/main/java/com/spotify/ffwd/http/model/v2/ValueDeserializer.java [50:67]


  public Value deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
      throws IOException, JsonProcessingException {

    JsonNode node = jsonParser.getCodec().readTree(jsonParser);

    if (node.get("distributionValue") != null) {
      byte[] bytes = node.get("distributionValue").binaryValue();
      ByteString byteString = ByteString.copyFrom(bytes);
      return Value.DistributionValue.create(byteString);
    }

    if (node.get("doubleValue") != null) {
      double val = node.get("doubleValue").asDouble();
      return Value.DoubleValue.create(val);
    }

    throw new RuntimeException("Unrecognized value type");
  }