Class EntityEncoder<T>

  • Type Parameters:
    T - the entity type
    All Implemented Interfaces:
    org.bson.codecs.Encoder<T>
    Direct Known Subclasses:
    LifecycleEncoder, MergingEncoder

    public class EntityEncoder<T>
    extends Object
    implements org.bson.codecs.Encoder<T>
    Since:
    2.0
    Developer note.
    This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Field Detail

      • OBJECT_ID_GENERATOR

        public static final org.bson.codecs.ObjectIdGenerator OBJECT_ID_GENERATOR
    • Constructor Detail

      • EntityEncoder

        protected EntityEncoder​(MorphiaCodec<T> morphiaCodec)
    • 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>
      • getEncoderClass

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

        protected <S,​V> boolean areEquivalentTypes​(Class<S> t1,
                                                         Class<V> t2)
      • encodeDiscriminator

        protected void encodeDiscriminator​(org.bson.BsonWriter writer,
                                           EntityModel model)
      • encodeIdProperty

        protected void encodeIdProperty​(org.bson.BsonWriter writer,
                                        Object instance,
                                        org.bson.codecs.EncoderContext encoderContext,
                                        @Nullable
                                        PropertyModel idModel)
      • encodeValue

        protected void encodeValue​(org.bson.BsonWriter writer,
                                   org.bson.codecs.EncoderContext encoderContext,
                                   PropertyModel model,
                                   @Nullable
                                   Object value)
      • getIdGenerator

        @Nullable
        protected org.bson.codecs.IdGenerator getIdGenerator()
      • writeValue

        protected void writeValue​(org.bson.BsonWriter writer,
                                  org.bson.codecs.EncoderContext encoderContext,
                                  PropertyModel model,
                                  @Nullable
                                  Object value)