Package com.mongodb
Class DBObjectCodec
java.lang.Object
com.mongodb.DBObjectCodec
- All Implemented Interfaces:
Codec<DBObject>,CollectibleCodec<DBObject>,Decoder<DBObject>,Encoder<DBObject>,OverridableUuidRepresentationCodec<DBObject>
@Deprecated(since="2021-05-27")
public class DBObjectCodec
extends Object
implements CollectibleCodec<DBObject>, OverridableUuidRepresentationCodec<DBObject>
Deprecated.
Usage of this API is not supported in AEM as a Cloud Service.
A collectible codec for a DBObject.
- Since:
- 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Construct an instance with the default codec registryDBObjectCodec(CodecRegistry codecRegistry) Deprecated.Construct an instance with the given codec registry.DBObjectCodec(CodecRegistry codecRegistry, BsonTypeClassMap bsonTypeClassMap) Deprecated.Construct an instance.DBObjectCodec(CodecRegistry codecRegistry, BsonTypeClassMap bsonTypeClassMap, com.mongodb.DBObjectFactory objectFactory) Deprecated.Construct an instance. -
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.booleandocumentHasId(DBObject document) Deprecated.Returns true if the given document has an _id.voidencode(BsonWriter writer, DBObject document, EncoderContext encoderContext) Deprecated.Encode an instance of the type parameterTinto a BSON value.generateIdIfAbsentFromDocument(DBObject document) Deprecated.Generates a value for the _id field on the given document, if the document does not have one.getDocumentId(DBObject document) Deprecated.Gets the _id of the given document if it contains one, otherwise throwsIllegalArgumentException.Deprecated.Returns the Class instance that this encodes.withUuidRepresentation(UuidRepresentation uuidRepresentation) Deprecated.Implementations must return a new instance with theUuidRepresentationoverridden with the given value.
-
Constructor Details
-
DBObjectCodec
public DBObjectCodec()Deprecated.Construct an instance with the default codec registry- Since:
- 3.7
-
DBObjectCodec
Deprecated.Construct an instance with the given codec registry.- Parameters:
codecRegistry- the non-null codec registry
-
DBObjectCodec
Deprecated.Construct an instance.- Parameters:
codecRegistry- the codec registrybsonTypeClassMap- the non-null BsonTypeClassMap
-
DBObjectCodec
public DBObjectCodec(CodecRegistry codecRegistry, BsonTypeClassMap bsonTypeClassMap, com.mongodb.DBObjectFactory objectFactory) Deprecated.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
Deprecated.Description copied from interface:EncoderEncode an instance of the type parameterTinto a BSON value. -
decode
Deprecated.Description copied from interface:DecoderDecodes a BSON value from the given reader into an instance of the type parameterT. -
getEncoderClass
Deprecated.Description copied from interface:EncoderReturns the Class instance that this encodes. This is necessary because Java does not reify generic types.- Specified by:
getEncoderClassin interfaceEncoder<DBObject>- Returns:
- the Class instance that this encodes.
-
documentHasId
Deprecated.Description copied from interface:CollectibleCodecReturns true if the given document has an _id.- Specified by:
documentHasIdin interfaceCollectibleCodec<DBObject>- Parameters:
document- the document in which to look for an _id- Returns:
- true if the document has an _id
-
getDocumentId
Deprecated.Description copied from interface:CollectibleCodecGets the _id of the given document if it contains one, otherwise throwsIllegalArgumentException. To avoid the latter case, calldocumentHasIdfirst to check.- Specified by:
getDocumentIdin interfaceCollectibleCodec<DBObject>- Parameters:
document- the document from which to get the _id- Returns:
- the _id of the document
-
generateIdIfAbsentFromDocument
Deprecated.Description copied from interface:CollectibleCodecGenerates a value for the _id field on the given document, if the document does not have one.- Specified by:
generateIdIfAbsentFromDocumentin interfaceCollectibleCodec<DBObject>- Parameters:
document- the document for which to generate a value for the _id.- Returns:
- the document with the _id
-
withUuidRepresentation
Deprecated.Description copied from interface:OverridableUuidRepresentationCodecImplementations must return a new instance with theUuidRepresentationoverridden with the given value.- Specified by:
withUuidRepresentationin interfaceOverridableUuidRepresentationCodec<DBObject>- Parameters:
uuidRepresentation- the UuidRepresentation- Returns:
- a new instance equivalent to this but with the given UuidRepresentation
-