Package org.bson.codecs
Class BsonValueCodec
- java.lang.Object
-
- org.bson.codecs.BsonValueCodec
-
-
Constructor Summary
Constructors Constructor Description BsonValueCodec()
Creates a new instance with a default codec registry that uses theBsonValueCodecProvider
.BsonValueCodec(CodecRegistry codecRegistry)
Creates a new instance initialised with the given codec registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BsonValue
decode(BsonReader reader, DecoderContext decoderContext)
Decodes a BSON value from the given reader into an instance of the type parameterT
.void
encode(BsonWriter writer, BsonValue value, EncoderContext encoderContext)
Encode an instance of the type parameterT
into a BSON value.Class<BsonValue>
getEncoderClass()
Returns the Class instance that this encodes.
-
-
-
Constructor Detail
-
BsonValueCodec
public BsonValueCodec()
Creates a new instance with a default codec registry that uses theBsonValueCodecProvider
.
-
BsonValueCodec
public BsonValueCodec(CodecRegistry codecRegistry)
Creates a new instance initialised with the given codec registry.- Parameters:
codecRegistry
- theCodecRegistry
to use to look up the codecs for encoding and decoding to/from BSON
-
-
Method Detail
-
decode
public BsonValue decode(BsonReader reader, DecoderContext decoderContext)
Description copied from interface:Decoder
Decodes a BSON value from the given reader into an instance of the type parameterT
.
-
encode
public void encode(BsonWriter writer, BsonValue value, EncoderContext encoderContext)
Description copied from interface:Encoder
Encode an instance of the type parameterT
into a BSON value.
-
getEncoderClass
public Class<BsonValue> getEncoderClass()
Description copied from interface:Encoder
Returns the Class instance that this encodes. This is necessary because Java does not reify generic types.- Specified by:
getEncoderClass
in interfaceEncoder<BsonValue>
- Returns:
- the Class instance that this encodes.
-
-