Package org.bson.codecs
Class BsonDocumentWrapperCodec
- java.lang.Object
-
- org.bson.codecs.BsonDocumentWrapperCodec
-
- All Implemented Interfaces:
Codec<BsonDocumentWrapper>
,Decoder<BsonDocumentWrapper>
,Encoder<BsonDocumentWrapper>
public class BsonDocumentWrapperCodec extends java.lang.Object implements Codec<BsonDocumentWrapper>
A Codec- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description BsonDocumentWrapperCodec(Codec<BsonDocument> bsonDocumentCodec)
Construct a new instance,
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BsonDocumentWrapper
decode(BsonReader reader, DecoderContext decoderContext)
Decoding ofBsonDocumentWrapper
instances is not supported, so this method will throwUnsupportedOperationException
in all cases.void
encode(BsonWriter writer, BsonDocumentWrapper value, EncoderContext encoderContext)
Encode an instance of the type parameterT
into a BSON value.java.lang.Class<BsonDocumentWrapper>
getEncoderClass()
Returns the Class instance that this encodes.
-
-
-
Constructor Detail
-
BsonDocumentWrapperCodec
public BsonDocumentWrapperCodec(Codec<BsonDocument> bsonDocumentCodec)
Construct a new instance,- Parameters:
bsonDocumentCodec
- the code to use if theBsonDocumentWrapper
has been unwrapped.
-
-
Method Detail
-
decode
public BsonDocumentWrapper decode(BsonReader reader, DecoderContext decoderContext)
Decoding ofBsonDocumentWrapper
instances is not supported, so this method will throwUnsupportedOperationException
in all cases.- Specified by:
decode
in interfaceDecoder<BsonDocumentWrapper>
- Parameters:
reader
- the BSON reader the readerdecoderContext
- a decoder context, currently unused- Returns:
- the document
-
encode
public void encode(BsonWriter writer, BsonDocumentWrapper value, EncoderContext encoderContext)
Description copied from interface:Encoder
Encode an instance of the type parameterT
into a BSON value.- Specified by:
encode
in interfaceEncoder<BsonDocumentWrapper>
- Parameters:
writer
- the BSON writer to encode intovalue
- the value to encodeencoderContext
- the encoder context
-
getEncoderClass
public java.lang.Class<BsonDocumentWrapper> 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<BsonDocumentWrapper>
- Returns:
- the Class instance that this encodes.
-
-