class JacksonRenderFactoryBase implements JsonRenderFactory {

    public abstract ObjectMapper config();

    protected SimpleModule module;

    protected void registerModule() {
        if (module != null) {
            config().registerModule(module);
        }
    }


    public <T> void addEncoder(Class<T> clz, JsonSerializer<T> encoder) {
        if (module == null) {
            module = new SimpleModule();
        }

        module.addSerializer(clz, encoder);
    }

    @Override
    public <T> void addConvertor(Class<T> clz, Converter<T,Object> converter) {
        addEncoder(clz, new JsonSerializer<T>() {
            @Override
            public void serialize(T source, JsonGenerator out, SerializerProvider sp) throws IOException {<FILL_FUNCTION_BODY>}
        });
    }
}

                Object val = converter.convert((T) source);

                if (val == null) {
                    out.writeNull();
                } else if (val instanceof String) {
                    out.writeString((String) val);
                } else if (val instanceof Number) {
                    if (val instanceof Integer || val instanceof Long) {
                        out.writeNumber(((Number) val).longValue());
                    } else {
                        out.writeNumber(((Number) val).doubleValue());
                    }
                } else {
                    throw new IllegalArgumentException("The result type of the converter is not supported: " + val.getClass().getName());
                }
            
<no_super_class>