Package com.mongodb

Class DBRefCodec

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


    public class DBRefCodec
    extends java.lang.Object
    implements org.bson.codecs.Codec<DBRef>
    A Codec for DBRef instances.
    Since:
    3.0
    • Constructor Summary

      Constructors 
      Constructor Description
      DBRefCodec​(org.bson.codecs.configuration.CodecRegistry registry)
      Construct an instance with the given registry, which is used to encode the id of the referenced document.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DBRef decode​(org.bson.BsonReader reader, org.bson.codecs.DecoderContext decoderContext)  
      void encode​(org.bson.BsonWriter writer, DBRef value, org.bson.codecs.EncoderContext encoderContext)  
      java.lang.Class<DBRef> getEncoderClass​()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DBRefCodec

        public DBRefCodec​(org.bson.codecs.configuration.CodecRegistry registry)
        Construct an instance with the given registry, which is used to encode the id of the referenced document.
        Parameters:
        registry - the non-null codec registry
    • Method Detail

      • encode

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

        public java.lang.Class<DBRef> getEncoderClass​()
        Specified by:
        getEncoderClass in interface org.bson.codecs.Encoder<DBRef>
      • decode

        public DBRef decode​(org.bson.BsonReader reader,
                            org.bson.codecs.DecoderContext decoderContext)
        Specified by:
        decode in interface org.bson.codecs.Decoder<DBRef>