Class EnumCodec<T extends Enum<T>>

  • Type Parameters:
    T - the type of the enum
    All Implemented Interfaces:
    org.bson.codecs.Codec<T>, org.bson.codecs.Decoder<T>, org.bson.codecs.Encoder<T>

    public class EnumCodec<T extends Enum<T>>
    extends Object
    implements org.bson.codecs.Codec<T>
    An enum codec
    Developer note.
    This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Constructor Detail

      • EnumCodec

        public EnumCodec​(Class<T> type)
        Creates a codec for the given type
        type - the type
    • Method Detail

      • encode

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

        public T decode​(org.bson.BsonReader reader,
                        org.bson.codecs.DecoderContext decoderContext)
        Specified by:
        decode in interface org.bson.codecs.Decoder<T extends Enum<T>>
      • getEncoderClass

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