mongo/src/org/immutables/mongo/bson4gson/GsonCodecs.java
public static <T> Codec<T> codecFromTypeAdapter(Class<T> type, TypeAdapter<T> adapter) {
    if (isReflectiveTypeAdapter(adapter)) {
      throw new CodecConfigurationException(String.format("%s can't be build from %s " +
                      "(for type %s)", TypeAdapterCodec.class.getSimpleName(),
              adapter.getClass().getName(), type.getName()));
    }
    return new TypeAdapterCodec<>(type, adapter);
  }
public static <T> Codec<T> codecFromTypeAdapter(Class<T> type, TypeAdapter<T> adapter) {
    if (isReflectiveTypeAdapter(adapter)) {
      throw new CodecConfigurationException(String.format("%s can't be build from %s " +
                      "(for type %s)", TypeAdapterCodec.class.getSimpleName(),
              adapter.getClass().getName(), type.getName()));
    }
    return new TypeAdapterCodec<>(type, adapter);
  }
public static < T > Codec < T > codecFromTypeAdapter ( Class < T > type , TypeAdapter < T > adapter ) { if ( isReflectiveTypeAdapter ( adapter ) ) { throw new CodecConfigurationException ( String . format ( "%s can't be build from %s " + "(for type %s)" , TypeAdapterCodec . class . getSimpleName ( ) , adapter . getClass ( ) . getName ( ) , type . getName ( ) ) ) ; } return new TypeAdapterCodec <> ( type , adapter ) ; }
Build a codec from {@link TypeAdapter}. Opposite of {@link #typeAdapterFromCodec(Codec)}.

@param type type handled by this adapter
@param adapter existing adapter
@param <T> codec value type
@throws CodecConfigurationException if adapter is not supported
@return new instance of the codec which handles {@code type}.
Build a codec from { @link TypeAdapter } . Opposite of { @link #typeAdapterFromCodec ( Codec ) } .