Class ObjectCodec

  • All Implemented Interfaces:
    org.bson.codecs.Codec<Object>, org.bson.codecs.Decoder<Object>, org.bson.codecs.Encoder<Object>

    public class ObjectCodec
    extends Object
    implements org.bson.codecs.Codec<Object>
    Defines a generic codec for Objects that will attempt to discover and use the correct codec.
    • Constructor Detail

      • ObjectCodec

        public ObjectCodec​(Mapper mapper)
        Creates a codec
        Parameters:
        mapper - the mapper to use
    • Method Detail

      • decode

        public Object decode​(org.bson.BsonReader reader,
                             org.bson.codecs.DecoderContext decoderContext)
        Specified by:
        decode in interface org.bson.codecs.Decoder<Object>
      • encode

        public void encode​(org.bson.BsonWriter writer,
                           Object value,
                           org.bson.codecs.EncoderContext encoderContext)
        Specified by:
        encode in interface org.bson.codecs.Encoder<Object>
      • getEncoderClass

        public Class<Object> getEncoderClass()
        Specified by:
        getEncoderClass in interface org.bson.codecs.Encoder<Object>