Interface CollectibleCodec<T>

  • Type Parameters:
    T - the document type
    All Superinterfaces:
    Codec<T>, Decoder<T>, Encoder<T>
    All Known Implementing Classes:
    BsonDocumentCodec, DBObjectCodec, DocumentCodec

    @Deprecated(since="2022-10-31")
    public interface CollectibleCodec<T>
    extends Codec<T>
    Deprecated.
    Usage of this API is not supported in AEM as a Cloud Service.
    A Codec that generates complete BSON documents for storage in a MongoDB collection.
    Since:
    3.0
    • Method Detail

      • generateIdIfAbsentFromDocument

        T generateIdIfAbsentFromDocument​(T document)
        Deprecated.
        Generates a value for the _id field on the given document, if the document does not have one.
        Parameters:
        document - the document for which to generate a value for the _id.
        Returns:
        the document with the _id
      • documentHasId

        boolean documentHasId​(T document)
        Deprecated.
        Returns true if the given document has an _id.
        Parameters:
        document - the document in which to look for an _id
        Returns:
        true if the document has an _id
      • getDocumentId

        BsonValue getDocumentId​(T document)
        Deprecated.
        Gets the _id of the given document if it contains one, otherwise throws IllegalArgumentException. To avoid the latter case, call documentHasId first to check.
        Parameters:
        document - the document from which to get the _id
        Returns:
        the _id of the document
        Throws:
        java.lang.IllegalStateException - if the document does not contain an _id