class EventUtils {

    static TypedValue typedValueFromJsonNode(JsonNode value, Type suggestedType) {
        if (value != null && value.isObject()) {
            return new StructureValue(
                    typeOf(value).getName(),
                    streamFrom(value.fields())
                            .collect(HashMap::new, (map, entry) -> map.put(entry.getKey(), typedValueFromJsonNode(entry.getValue(), null)), HashMap::putAll)
            );
        }
        if (value != null && value.isArray()) {
            return new CollectionValue(
                    typeOf(value).getName(),
                    streamFrom(value.elements()).map(v -> typedValueFromJsonNode(v, null)).collect(Collectors.toList())
            );
        }
        Type finalType = Optional.ofNullable(suggestedType).orElseGet(() -> typeOf(value));
        return new UnitValue(finalType.getName(), value);
    }

    private  EventUtils();

}