private static <T> T getVal(T clazz, JsonNode node) {
        if (clazz.equals(String.class)) {
            return (T) node.asText();
        } else if (clazz.equals(Integer.class) || clazz.equals(int.class)) {
            return (T) Integer.valueOf(node.intValue());
        } else if (clazz.equals(Long.class) || clazz.equals(long.class)) {
            return (T) Long.valueOf(node.longValue());
        } else if (clazz.equals(Float.class) || clazz.equals(float.class)) {
            return (T) Float.valueOf(node.floatValue());
        } else if (clazz.equals(Double.class) || clazz.equals(double.class)) {
            return (T) Double.valueOf(node.doubleValue());
        } else if (node.isObject()) {
            if (node.has(TikaJsonSerializer.INSTANTIATED_CLASS_KEY)) {
                Optional<T> optional = deserializeObject(node);
                if (optional.isPresent()) {
                    return optional.get();
                }
            } else {
                throw new IllegalArgumentException("I see a json object, but I don't see " +
                        TikaJsonSerializer.INSTANTIATED_CLASS_KEY + ": " + node);
            }
        }
        //add short, boolean
        throw new IllegalArgumentException("I regret I don't yet support: " + clazz);
    }
See the notes @link{TikaJsonSerializer}.
<p>
This currently requires a setString() option on objects that have enum parameters.
tika-serialization/src/main/java/org/apache/tika/serialization/TikaJsonDeserializer.java