private static void serializePrimitiveAndBoxed(String paramName, Object obj, JsonGenerator jsonGenerator) throws IOException {
        Class clazz = obj.getClass();
        if (paramName != null) {
            jsonGenerator.writeFieldName(paramName);
        }
        if (clazz.equals(String.class)) {
            jsonGenerator.writeString((String) obj);
        } else if (clazz.equals(Integer.class)) {
            jsonGenerator.writeNumber((Integer) obj);
        } else if (clazz.equals(Short.class)) {
            jsonGenerator.writeNumber((Short) obj);
        } else if (clazz.equals(Long.class)) {
            jsonGenerator.writeNumber((Long) obj);
        } else if (clazz.equals(Float.class)) {
            jsonGenerator.writeNumber((Float) obj);
        } else if (clazz.equals(Double.class)) {
            jsonGenerator.writeNumber((Double) obj);
        } else if (clazz.equals(Boolean.class)) {
            jsonGenerator.writeBoolean((Boolean) obj);
        } else if (clazz.equals(short.class)) {
            jsonGenerator.writeNumber((short) obj);
        } else if (clazz.equals(int.class)) {
            jsonGenerator.writeNumber((int) obj);
        } else if (clazz.equals(long.class)) {
            jsonGenerator.writeNumber((long) obj);
        } else if (clazz.equals(float.class)) {
            jsonGenerator.writeNumber((float) obj);
        } else if (clazz.equals(double.class)) {
            jsonGenerator.writeNumber((double) obj);
        } else if (clazz.equals(boolean.class)) {
            jsonGenerator.writeBoolean((boolean) obj);
        } else {
            throw new UnsupportedOperationException("I regret that I don't yet support " + clazz);
        }

    }
@param fieldName     can be null -- used only for logging and debugging
@param obj
@param jsonGenerator
@throws TikaSerializationException
tika-serialization/src/main/java/org/apache/tika/serialization/TikaJsonSerializer.java