@Override
    public void encode(BsonWriter writer, T value, EncoderContext encoderContext) {
      final BsonGenerator generator = new BsonGenerator(0, mapper, writer);
      try {
        mapper.writerFor(getEncoderClass()).writeValue(generator, value);
      } catch (IOException e) {
        throw new RuntimeException("Couldn't serialize [" + value + "] as " + getEncoderClass(), e);
      }
    }
Utility class to convert to / from {@link CodecRegistry} and {@link ObjectMapper}.

<p>Please note that Jackson support is currently experimental.
mongo/src/org/immutables/mongo/bson4jackson/JacksonCodecs.java