Class TransactionGetResult


  • public class TransactionGetResult
    extends java.lang.Object
    Represents a value fetched from Couchbase, along with additional transactional metadata.
    • Constructor Detail

      • TransactionGetResult

        @Internal
        public TransactionGetResult​(java.lang.String id,
                                    @Nullable
                                    byte[] content,
                                    long cas,
                                    com.couchbase.client.java.ReactiveCollection collection,
                                    @Nullable
                                    TransactionLinks links,
                                    TransactionJsonDocumentStatus status,
                                    java.util.Optional<DocumentMetadata> documentMetadata,
                                    com.couchbase.client.java.codec.Transcoder transcoder,
                                    java.util.Optional<com.couchbase.client.java.json.JsonObject> txnMeta,
                                    java.util.Optional<java.lang.String> crc32OfGet)
        Parameters:
        content - will be nullable for tombstones, and some niche cases like REMOVE to REPLACE on same doc
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • documentMetadata

        @Internal
        public java.util.Optional<DocumentMetadata> documentMetadata()
      • id

        public java.lang.String id()
        Returns the document's ID, which must be unique across the bucket.
      • cas

        public long cas()
        Returns the document's CAS (compare-and-swap) value, used for optimistic concurrency.
      • contentAsObject

        public com.couchbase.client.java.json.JsonObject contentAsObject()
        Decodes the content of the document into a JsonObject using the default decoder.
      • contentAs

        public <T> T contentAs​(java.lang.Class<T> target)
        Decodes the content of the document into the target class.

        The Transcoder configured on the underlying Java SDK us used.

        Parameters:
        target - the target class to decode the encoded content into.
      • contentAs

        @Uncommitted
        public <T> T contentAs​(java.lang.Class<T> target,
                               com.couchbase.client.java.codec.JsonSerializer serializer)
        Decodes the content of the document into the target class, using a custom JsonSerializer.
        Parameters:
        target - the target class to decode the encoded content into.
        serializer - the serializer to use
      • contentAsBytes

        @Uncommitted
        public byte[] contentAsBytes()
        Returns the raw unconverted contents as a byte[].
      • status

        @Deprecated
        @Nullable
        public TransactionJsonDocumentStatus status()
        Deprecated.
        this field is now deprecated as of 1.1.3 and should no longer be used or checked by the application.
        Returns the document's status, or null if it is unavailable.

      • createFrom

        @Internal
        public static TransactionGetResult createFrom​(com.couchbase.client.java.ReactiveCollection collection,
                                                      java.lang.String documentId,
                                                      com.couchbase.client.java.kv.LookupInResult doc,
                                                      TransactionJsonDocumentStatus status,
                                                      com.couchbase.client.java.codec.Transcoder transcoder)
      • collection

        public com.couchbase.client.java.ReactiveCollection collection()