mongo/src/org/immutables/mongo/bson4gson/GsonCodecs.java
public static CodecRegistry codecRegistryFromGson(final Gson gson) {
    Preconditions.checkNotNull(gson, "gson");
    return new CodecRegistry() {
      @Override
      public <T> Codec<T> get(Class<T> clazz) {
        return codecFromTypeAdapter(clazz, gson.getAdapter(clazz));
      }
    };
  }
public static CodecRegistry codecRegistryFromGson(final Gson gson) {
    Preconditions.checkNotNull(gson, "gson");
    return new CodecRegistry() {
      @Override
      public <T> Codec<T> get(Class<T> clazz) {
        return codecFromTypeAdapter(clazz, gson.getAdapter(clazz));
      }
    };
  }
Given existing {@code Gson} instance builds a {@link CodecRegistry}.

@param gson preconfigured instance
@return wrapper for {@code gson}.