Package org.bson.codecs
Class BsonDocumentCodec
java.lang.Object
org.bson.codecs.BsonDocumentCodec
- All Implemented Interfaces:
Codec<BsonDocument>,CollectibleCodec<BsonDocument>,Decoder<BsonDocument>,Encoder<BsonDocument>
@Deprecated(since="2022-10-31")
public class BsonDocumentCodec
extends Object
implements CollectibleCodec<BsonDocument>
Deprecated.
Usage of this API is not supported in AEM as a Cloud Service.
A codec for BsonDocument instances.
- Since:
- 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new instance with a default codec registry that uses theBsonValueCodecProvider.BsonDocumentCodec(CodecRegistry codecRegistry) Deprecated.Creates a new instance initialised with the given codec registry. -
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(BsonDocument document) Deprecated.Returns true if the given document has an _id.voidencode(BsonWriter writer, BsonDocument value, EncoderContext encoderContext) Deprecated.Encode an instance of the type parameterTinto a BSON value.generateIdIfAbsentFromDocument(BsonDocument document) Deprecated.Generates a value for the _id field on the given document, if the document does not have one.Deprecated.Gets theCodecRegistryfor thisCodec.getDocumentId(BsonDocument document) Deprecated.Gets the _id of the given document if it contains one, otherwise throwsIllegalArgumentException.Deprecated.Returns the Class instance that this encodes.
-
Constructor Details
-
BsonDocumentCodec
public BsonDocumentCodec()Deprecated.Creates a new instance with a default codec registry that uses theBsonValueCodecProvider. -
BsonDocumentCodec
Deprecated.Creates a new instance initialised with the given codec registry.- Parameters:
codecRegistry- theCodecRegistryto use to look up the codecs for encoding and decoding to/from BSON
-
-
Method Details
-
getCodecRegistry
Deprecated.Gets theCodecRegistryfor thisCodec.- Returns:
- the registry
-
decode
Deprecated.Description copied from interface:DecoderDecodes a BSON value from the given reader into an instance of the type parameterT.- Specified by:
decodein interfaceDecoder<BsonDocument>- Parameters:
reader- the BSON readerdecoderContext- the decoder context- Returns:
- an instance of the type parameter
T.
-
encode
Deprecated.Description copied from interface:EncoderEncode an instance of the type parameterTinto a BSON value.- Specified by:
encodein interfaceEncoder<BsonDocument>- Parameters:
writer- the BSON writer to encode intovalue- the value to encodeencoderContext- the encoder context
-
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<BsonDocument>- Returns:
- the Class instance that this encodes.
-
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<BsonDocument>- Parameters:
document- the document for which to generate a value for the _id.- Returns:
- the document with the _id
-
documentHasId
Deprecated.Description copied from interface:CollectibleCodecReturns true if the given document has an _id.- Specified by:
documentHasIdin interfaceCollectibleCodec<BsonDocument>- 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<BsonDocument>- Parameters:
document- the document from which to get the _id- Returns:
- the _id of the document
-