Package com.mongodb
Class DBObjectCodec
java.lang.Object
com.mongodb.DBObjectCodec
- All Implemented Interfaces:
Codec<DBObject>
,CollectibleCodec<DBObject>
,Decoder<DBObject>
,Encoder<DBObject>
,OverridableUuidRepresentationCodec<DBObject>
public class DBObjectCodec
extends Object
implements CollectibleCodec<DBObject>, OverridableUuidRepresentationCodec<DBObject>
A collectible codec for a DBObject.
- Since:
- 3.0
-
Constructor Summary
ConstructorDescriptionConstruct an instance with the default codec registryDBObjectCodec
(CodecRegistry codecRegistry) Construct an instance with the given codec registry.DBObjectCodec
(CodecRegistry codecRegistry, BsonTypeClassMap bsonTypeClassMap) Construct an instance.DBObjectCodec
(CodecRegistry codecRegistry, BsonTypeClassMap bsonTypeClassMap, com.mongodb.DBObjectFactory objectFactory) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptiondecode
(BsonReader reader, DecoderContext decoderContext) boolean
documentHasId
(DBObject document) void
encode
(BsonWriter writer, DBObject document, EncoderContext encoderContext) generateIdIfAbsentFromDocument
(DBObject document) getDocumentId
(DBObject document) withUuidRepresentation
(UuidRepresentation uuidRepresentation)
-
Constructor Details
-
DBObjectCodec
public DBObjectCodec()Construct an instance with the default codec registry- Since:
- 3.7
-
DBObjectCodec
Construct an instance with the given codec registry.- Parameters:
codecRegistry
- the non-null codec registry
-
DBObjectCodec
Construct an instance.- Parameters:
codecRegistry
- the codec registrybsonTypeClassMap
- the non-null BsonTypeClassMap
-
DBObjectCodec
public DBObjectCodec(CodecRegistry codecRegistry, BsonTypeClassMap bsonTypeClassMap, com.mongodb.DBObjectFactory objectFactory) Construct an instance.- Parameters:
codecRegistry
- the non-null codec registrybsonTypeClassMap
- the non-null BsonTypeClassMapobjectFactory
- the non-null object factory used to create empty DBObject instances when decoding
-
-
Method Details
-
encode
-
decode
-
getEncoderClass
- Specified by:
getEncoderClass
in interfaceEncoder<DBObject>
-
documentHasId
- Specified by:
documentHasId
in interfaceCollectibleCodec<DBObject>
-
getDocumentId
- Specified by:
getDocumentId
in interfaceCollectibleCodec<DBObject>
-
generateIdIfAbsentFromDocument
- Specified by:
generateIdIfAbsentFromDocument
in interfaceCollectibleCodec<DBObject>
-
withUuidRepresentation
- Specified by:
withUuidRepresentation
in interfaceOverridableUuidRepresentationCodec<DBObject>
-