Class TransactionGetMultiResult

java.lang.Object
com.couchbase.client.java.transactions.getmulti.TransactionGetMultiResult

@Uncommitted public class TransactionGetMultiResult extends Object
The result of a getMulti operation, which contains the fetched documents.
  • Constructor Details

  • Method Details

    • exists

      public boolean exists(int specIndex)
      If the document matching this `specIndex` existed.
      Parameters:
      specIndex - this is in the same order as the `specs` list provided to the getMulti() operation.
    • contentAsObject

      public JsonObject contentAsObject(int specIndex)
      Decodes the content of a document into a JsonObject.

      The JsonSerializer configured on the underlying Java SDK is used, unless a Transcoder was specified in the TransactionGetMultiSpec, in which case that is used.

      The document is at the specified `specIndex`.

      If the document did not exist, a DocumentNotFoundException is thrown. exists(int) can be called initially to check if the document existed.

      Parameters:
      specIndex - this is in the same order as the `specs` list provided to the getMulti() operation.
    • contentAs

      public <T> T contentAs(int specIndex, Class<T> target)
      Decodes the content of a document into the target class.

      The JsonSerializer configured on the underlying Java SDK is used, unless a Transcoder was specified in the TransactionGetMultiSpec, in which case that is used.

      The document is at the specified `specIndex`.

      If the document did not exist, a DocumentNotFoundException is thrown. exists(int) can be called initially to check if the document existed.

      Parameters:
      specIndex - this is in the same order as the `specs` list provided to the getMulti() operation.
      target - the target class to decode the encoded content into.
    • contentAs

      public <T> T contentAs(int specIndex, TypeRef<T> target)
      Decodes the content of a document into the target class.

      The JsonSerializer configured on the underlying Java SDK is used, unless a Transcoder was specified in the TransactionGetMultiSpec, in which case that is used.

      The document is at the specified `specIndex`.

      If the document did not exist, a DocumentNotFoundException is thrown. exists(int) can be called initially to check if the document existed.

      Parameters:
      specIndex - this is in the same order as the `specs` list provided to the getMulti() operation.
      target - the target class to decode the encoded content into.
    • contentAsBytes

      public byte[] contentAsBytes(int specIndex)
      Returns the raw unconverted contents as a byte[], bypassing any Serializer or Transcoder.
    • size

      public int size()