Class BsonDocumentWrapperCodec

java.lang.Object
org.bson.codecs.BsonDocumentWrapperCodec
All Implemented Interfaces:
Codec<BsonDocumentWrapper>, Decoder<BsonDocumentWrapper>, Encoder<BsonDocumentWrapper>

public class BsonDocumentWrapperCodec extends Object implements Codec<BsonDocumentWrapper>
A Codec
Since:
3.0
  • Constructor Details

    • BsonDocumentWrapperCodec

      public BsonDocumentWrapperCodec(Codec<BsonDocument> bsonDocumentCodec)
      Construct a new instance,
      Parameters:
      bsonDocumentCodec - the code to use if the BsonDocumentWrapper has been unwrapped.
  • Method Details

    • decode

      public BsonDocumentWrapper decode(BsonReader reader, DecoderContext decoderContext)
      Decoding of BsonDocumentWrapper instances is not supported, so this method will throw UnsupportedOperationException in all cases.
      Specified by:
      decode in interface Decoder<BsonDocumentWrapper>
      Parameters:
      reader - the BSON reader the reader
      decoderContext - 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 parameter T into a BSON value.
      Specified by:
      encode in interface Encoder<BsonDocumentWrapper>
      Parameters:
      writer - the BSON writer to encode into
      value - the value to encode
      encoderContext - the encoder context
    • getEncoderClass

      public 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 interface Encoder<BsonDocumentWrapper>
      Returns:
      the Class instance that this encodes.