@Override
    public void encode(org.bson.BsonWriter writer, T value, EncoderContext encoderContext) {
      try {
        adapter.write(new BsonWriter(writer), value);
      } catch (IOException e) {
        throw new RuntimeException(String.format("Couldn't write value of class %s: %s", clazz.getName(), value), e);
      }
    }
Codec which delegates all calls to existing type adapter.

@param <T> type handled by this codec
mongo/src/org/immutables/mongo/bson4gson/GsonCodecs.java