List of usage examples for com.fasterxml.jackson.databind ObjectWriter withRootName
public ObjectWriter withRootName(String rootName)
From source file:io.github.jdocker.common.vertx.JacksonCodec.java
@Override public void encodeToWire(Buffer buffer, Object o) { ObjectWriter writer = mapper.writer(); StringWriter w = new StringWriter(); try {//from ww w .j av a 2s .c o m writer.withRootName(o.getClass().getSimpleName()).writeValue(w, o); buffer.appendBytes(w.toString().getBytes()); } catch (IOException e) { throw new IllegalStateException("Cannot serialize into json: " + o, e); } }