Search in sources :

Example 1 with JacksonDataTemplateCodec

use of com.linkedin.data.template.JacksonDataTemplateCodec in project rest.li by linkedin.

the class IndentedPdlBuilder method writeJson.

@Override
PdlBuilder writeJson(Object value, DataSchema schema) throws IOException {
    if (schema != null) {
        JacksonDataTemplateCodec jsonCodec = new JacksonDataTemplateCodec();
        jsonCodec.setPrettyPrinter(getPrettyPrinter());
        write(toJson(value, jsonCodec, schema));
    } else {
        JacksonDataCodec jsonCodec = new JacksonDataCodec();
        jsonCodec.setPrettyPrinter(getPrettyPrinter());
        jsonCodec.setSortKeys(true);
        write(toJson(value, jsonCodec));
    }
    return this;
}
Also used : JacksonDataCodec(com.linkedin.data.codec.JacksonDataCodec) JacksonDataTemplateCodec(com.linkedin.data.template.JacksonDataTemplateCodec)

Aggregations

JacksonDataCodec (com.linkedin.data.codec.JacksonDataCodec)1 JacksonDataTemplateCodec (com.linkedin.data.template.JacksonDataTemplateCodec)1