Class VitamDocumentCodec<T extends org.bson.Document>

  • Type Parameters:
    T - The parameter of the class
    All Implemented Interfaces:
    org.bson.codecs.Codec<T>, org.bson.codecs.CollectibleCodec<T>, org.bson.codecs.Decoder<T>, org.bson.codecs.Encoder<T>

    public class VitamDocumentCodec<T extends org.bson.Document>
    extends java.lang.Object
    implements org.bson.codecs.CollectibleCodec<T>
    MongoDB Codec for all VitamDocument
    • Constructor Summary

      Constructors 
      Constructor Description
      VitamDocumentCodec​(java.lang.Class<T> clazz)
      Constructor
    • Method Summary

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

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

      • VitamDocumentCodec

        public VitamDocumentCodec​(java.lang.Class<T> clazz)
        Constructor
        Parameters:
        clazz - class of unknown 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 org.bson.Document>
      • generateIdIfAbsentFromDocument

        public T generateIdIfAbsentFromDocument​(T document)
        Specified by:
        generateIdIfAbsentFromDocument in interface org.bson.codecs.CollectibleCodec<T extends org.bson.Document>
      • documentHasId

        public boolean documentHasId​(T document)
        Specified by:
        documentHasId in interface org.bson.codecs.CollectibleCodec<T extends org.bson.Document>
      • getDocumentId

        public org.bson.BsonValue getDocumentId​(T document)
        Specified by:
        getDocumentId in interface org.bson.codecs.CollectibleCodec<T extends org.bson.Document>
      • getEncoderClass

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

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