public static <T> TypeAdapter<T> typeAdapterFromCodec(final Codec<T> codec) {
    """
	Build a TypeAdapter from {@link Codec} opposite of {@link #codecFromTypeAdapter(Class, TypeAdapter)}.
	
	@param codec existing codec
	@return type adapter which delegates calls to a codec.
    """
    Preconditions.checkNotNull(codec, "codec");
    return new TypeAdapter<T>() {
      @Override
      public void write(JsonWriter out, T value) throws IOException {
        BsonWriter writer = (BsonWriter) out;
        org.bson.BsonWriter delegate = writer.unwrap();
        codec.encode(delegate, value, EncoderContext.builder().build());
      }

      @Override
      public T read(JsonReader in) throws IOException {
        BsonReader reader = (BsonReader) in;
        org.bson.BsonReader delegate = reader.unwrap();
        return codec.decode(delegate, DecoderContext.builder().build());
      }
    };
  }
public static <T> TypeAdapter<T> typeAdapterFromCodec(final Codec<T> codec) {
    Preconditions.checkNotNull(codec, "codec");
    return new TypeAdapter<T>() {
      @Override
      public void write(JsonWriter out, T value) throws IOException {
        BsonWriter writer = (BsonWriter) out;
        org.bson.BsonWriter delegate = writer.unwrap();
        codec.encode(delegate, value, EncoderContext.builder().build());
      }

      @Override
      public T read(JsonReader in) throws IOException {
        BsonReader reader = (BsonReader) in;
        org.bson.BsonReader delegate = reader.unwrap();
        return codec.decode(delegate, DecoderContext.builder().build());
      }
    };
  }
public static < T > TypeAdapter < T > typeAdapterFromCodec ( final Codec < T > codec ) { Preconditions . checkNotNull ( codec , "codec" ) ; return new TypeAdapter < T > ( ) { @ Override public void write ( JsonWriter out , T value ) throws IOException { BsonWriter writer = ( BsonWriter ) out ; org . bson . BsonWriter delegate = writer . unwrap ( ) ; codec . encode ( delegate , value , EncoderContext . builder ( ) . build ( ) ) ; } @ Override public T read ( JsonReader in ) throws IOException { BsonReader reader = ( BsonReader ) in ; org . bson . BsonReader delegate = reader . unwrap ( ) ; return codec . decode ( delegate , DecoderContext . builder ( ) . build ( ) ) ; } } ; }
Build a TypeAdapter from {@link Codec} opposite of {@link #codecFromTypeAdapter(Class, TypeAdapter)}.

@param codec existing codec
@return type adapter which delegates calls to a codec.
Build a TypeAdapter from { @link Codec } opposite of { @link #codecFromTypeAdapter ( Class TypeAdapter ) } .