Class LocaleCodec

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

    public class LocaleCodec
    extends Object
    implements org.bson.codecs.Codec<Locale>
    Converts a Locale to/from a valid database structure.
    • Constructor Detail

      • LocaleCodec

        public LocaleCodec()
    • Method Detail

      • getEncoderClass

        public Class<Locale> 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<Locale>
        Returns:
        the Class instance that this encodes.
      • decode

        public Locale 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<Locale>
        Parameters:
        reader - the BSON reader
        decoderContext - the decoder context
        Returns:
        an instance of the type parameter T.
      • encode

        public void encode​(org.bson.BsonWriter writer,
                           Locale 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<Locale>
        Parameters:
        writer - the BSON writer to encode into
        value - the value to encode
        encoderContext - the encoder context