Class ReferenceCodec

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

    public class ReferenceCodec
    extends BaseReferenceCodec<Object>
    implements PropertyHandler
    Developer note.
    This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Constructor Detail

      • ReferenceCodec

        public ReferenceCodec​(Datastore datastore,
                              PropertyModel propertyModel)
        Creates a codec
        Parameters:
        datastore - the datastore to use
        propertyModel - the reference property
    • Method Detail

      • encodeId

        @Nullable
        public static Object encodeId​(Mapper mapper,
                                      Datastore datastore,
                                      Object value,
                                      PropertyModel model)
        Encodes a value
        Parameters:
        mapper - the mapper to use
        datastore - the datastore to use
        value - the value to encode
        model - the mapped class of the field type
        Returns:
        the encoded value
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • encodeId

        @Nullable
        public static Object encodeId​(Mapper mapper,
                                      Object value,
                                      EntityModel model)
        Encodes a value
        Parameters:
        mapper - the mapper to use
        value - the value to encode
        model - the mapped class of the field type
        Returns:
        the encoded value
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • processId

        @NonNull
        public static Object processId​(Object decode,
                                       Mapper mapper,
                                       org.bson.codecs.DecoderContext decoderContext)
        Decodes an ID value
        Parameters:
        decode - the value to decode
        mapper - the mapper to use
        decoderContext - the decoder context
        Returns:
        the decoded value
      • decode

        @Nullable
        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 instance,
                           org.bson.codecs.EncoderContext encoderContext)
        Specified by:
        encode in interface org.bson.codecs.Encoder<Object>
      • getEncoderClass

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