in statefun-flink/statefun-flink-common/src/main/java/org/apache/flink/statefun/flink/common/json/Selectors.java [175:201]
public static Map<String, Long> longPropertiesAt(JsonNode node, JsonPointer pointer) {
node = node.at(pointer);
if (node.isMissingNode()) {
return Collections.emptyMap();
}
if (!node.isArray()) {
throw new WrongTypeException(pointer, "not a key-value list");
}
Map<String, Long> longProperties = new LinkedHashMap<>();
for (JsonNode listElement : node) {
Iterator<Map.Entry<String, JsonNode>> fields = listElement.fields();
if (!fields.hasNext()) {
throw new WrongTypeException(pointer, "not a key-value list");
}
Map.Entry<String, JsonNode> field = fields.next();
if (!field.getValue().isLong() && !field.getValue().isInt()) {
throw new WrongTypeException(
pointer,
"value for key-value pair at "
+ field.getKey()
+ " is not a long: "
+ field.getValue());
}
longProperties.put(field.getKey(), field.getValue().asLong());
}
return longProperties;
}