Package org.bson.codecs
Class MapCodec
java.lang.Object
org.bson.codecs.MapCodec
- All Implemented Interfaces:
Codec<Map<String,
,Object>> Decoder<Map<String,
,Object>> Encoder<Map<String,
,Object>> OverridableUuidRepresentationCodec<Map<String,
Object>>
@Deprecated
public class MapCodec
extends Object
implements Codec<Map<String,Object>>, OverridableUuidRepresentationCodec<Map<String,Object>>
Deprecated.
A Codec for Map instances.
This class has been deprecated because it's not possible to extend it to support Map
s that are not type-compatible with
HashMap
.
- Since:
- 3.5
-
Constructor Summary
ConstructorDescriptionMapCodec()
Deprecated.Construct a new instance with a defaultCodecRegistry
MapCodec
(CodecRegistry registry) Deprecated.Construct a new instance with the given registryMapCodec
(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap) Deprecated.Construct a new instance with the given registry and BSON type class map.MapCodec
(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap, Transformer valueTransformer) Deprecated.Construct a new instance with the given registry and BSON type class map. -
Method Summary
Modifier and TypeMethodDescriptiondecode
(BsonReader reader, DecoderContext decoderContext) Deprecated.Decodes a BSON value from the given reader into an instance of the type parameterT
.void
encode
(BsonWriter writer, Map<String, Object> map, EncoderContext encoderContext) Deprecated.Encode an instance of the type parameterT
into a BSON value.Deprecated.Returns the Class instance that this encodes.withUuidRepresentation
(UuidRepresentation uuidRepresentation) Deprecated.Implementations must return a new instance with theUuidRepresentation
overridden with the given value.
-
Constructor Details
-
MapCodec
public MapCodec()Deprecated.Construct a new instance with a defaultCodecRegistry
-
MapCodec
Deprecated.Construct a new instance with the given registry- Parameters:
registry
- the registry
-
MapCodec
Deprecated.Construct a new instance with the given registry and BSON type class map.- Parameters:
registry
- the registrybsonTypeClassMap
- the BSON type class map
-
MapCodec
public MapCodec(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap, Transformer valueTransformer) Deprecated.Construct a new instance with the given registry and BSON type class map. The transformer is applied as a last step when decoding values, which allows users of this codec to control the decoding process. For example, a user of this class could substitute a value decoded as a Document with an instance of a special purpose class (e.g., one representing a DBRef in MongoDB).- Parameters:
registry
- the registrybsonTypeClassMap
- the BSON type class mapvalueTransformer
- the value transformer to use as a final step when decoding the value of any field in the map
-
-
Method Details
-
withUuidRepresentation
Deprecated.Description copied from interface:OverridableUuidRepresentationCodec
Implementations must return a new instance with theUuidRepresentation
overridden with the given value.- Specified by:
withUuidRepresentation
in interfaceOverridableUuidRepresentationCodec<Map<String,
Object>> - Parameters:
uuidRepresentation
- the UuidRepresentation- Returns:
- a new instance equivalent to this but with the given UuidRepresentation
-
encode
Deprecated.Description copied from interface:Encoder
Encode an instance of the type parameterT
into a BSON value. -
decode
Deprecated.Description copied from interface:Decoder
Decodes a BSON value from the given reader into an instance of the type parameterT
. -
getEncoderClass
Deprecated.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<Map<String,
Object>> - Returns:
- the Class instance that this encodes.
-
MapCodecProvider