Class VitamDocumentCodec<T extends org.bson.Document>

java.lang.Object
fr.gouv.vitam.common.database.translators.mongodb.VitamDocumentCodec<T>
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 Object implements org.bson.codecs.CollectibleCodec<T>
MongoDB Codec for all VitamDocument
  • Constructor Details

    • VitamDocumentCodec

      public VitamDocumentCodec(Class<T> clazz)
      Constructor
      Parameters:
      clazz - class of unknown type
  • Method Details

    • 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 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>