Class KeyCodec

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

    public class KeyCodec
    extends Object
    implements org.bson.codecs.Codec<Key>
    Defines the codec for Key types
    • Method Detail

      • encode

        public void encode​(org.bson.BsonWriter writer,
                           Key value,
                           org.bson.codecs.EncoderContext encoderContext)
        Description copied from interface: org.bson.codecs.Encoder
        Encode an instance of the type parameter T into a BSON value.
        Specified by:
        encode in interface org.bson.codecs.Encoder<Key>
        Parameters:
        writer - the BSON writer to encode into
        value - the value to encode
        encoderContext - the encoder context
      • getEncoderClass

        public Class<Key> getEncoderClass()
        Description copied from interface: org.bson.codecs.Encoder
        Returns the Class instance that this encodes. This is necessary because Java does not reify generic types.
        Specified by:
        getEncoderClass in interface org.bson.codecs.Encoder<Key>
        Returns:
        the Class instance that this encodes.
      • decode

        public Key decode​(org.bson.BsonReader reader,
                          org.bson.codecs.DecoderContext decoderContext)
        Description copied from interface: org.bson.codecs.Decoder
        Decodes a BSON value from the given reader into an instance of the type parameter T.
        Specified by:
        decode in interface org.bson.codecs.Decoder<Key>
        Parameters:
        reader - the BSON reader
        decoderContext - the decoder context
        Returns:
        an instance of the type parameter T.