public static Integer readFieldAsInteger()

in src/main/java/com/epam/eco/commons/kafka/serde/jackson/JsonDeserializerUtils.java [65:85]


    public static Integer readFieldAsInteger(
            JsonNode node,
            String fieldName,
            boolean nullable,
            DeserializationContext context) throws JsonMappingException {
        JsonNode fieldNode = node.get(fieldName);

        if (fieldNode == null || fieldNode.isNull()) {
            if (nullable) {
                return null;
            } else {
                context.reportInputMismatch(Integer.class, "% is null", fieldName);
            }
        }

        if (!fieldNode.canConvertToInt()) {
            context.reportInputMismatch(Integer.class, "% is invalid", fieldName);
        }

        return fieldNode.asInt();
    }