Class LegacyDocument

java.lang.Object
com.couchbase.client.java.document.AbstractDocument<Object>
com.couchbase.client.java.document.LegacyDocument
All Implemented Interfaces:
Document<Object>

public class LegacyDocument
extends AbstractDocument<Object>
This document is fully compatible with Java SDK 1.* stored documents. It is not compatible with other SDKs. It should be used to interact with legacy documents and code, but it is recommended to switch to the unifying document types (Json* and String) if possible to guarantee better interoperability in the future.
Since:
2.0
Author:
Michael Nitschinger
  • Method Details

    • create

      public static LegacyDocument create​(String id)
      Creates a LegacyDocument which the document id.
      Parameters:
      id - the per-bucket unique document id.
      Returns:
      a LegacyDocument.
    • create

      public static LegacyDocument create​(String id, Object content)
      Creates a LegacyDocument which the document id and JSON content.
      Parameters:
      id - the per-bucket unique document id.
      content - the content of the document.
      Returns:
      a LegacyDocument.
    • create

      public static LegacyDocument create​(String id, Object content, long cas)
      Creates a LegacyDocument which the document id, JSON content and the CAS value.
      Parameters:
      id - the per-bucket unique document id.
      content - the content of the document.
      cas - the CAS (compare and swap) value for optimistic concurrency.
      Returns:
      a LegacyDocument.
    • create

      public static LegacyDocument create​(String id, int expiry, Object content)
      Creates a LegacyDocument which the document id, JSON content and the expiration time.
      Parameters:
      id - the per-bucket unique document id.
      expiry - the expiration time of the document.
      content - the content of the document.
      Returns:
      a LegacyDocument.
    • create

      public static LegacyDocument create​(String id, int expiry, Object content, long cas)
      Creates a LegacyDocument which the document id, JSON content, CAS value, expiration time and status code. This factory method is normally only called within the client library when a response is analyzed and a document is returned which is enriched with the status code. It does not make sense to pre populate the status field from the user level code.
      Parameters:
      id - the per-bucket unique document id.
      expiry - the expiration time of the document.
      content - the content of the document.
      cas - the CAS (compare and swap) value for optimistic concurrency.
      Returns:
      a LegacyDocument.
    • create

      public static LegacyDocument create​(String id, int expiry, Object content, long cas, MutationToken mutationToken)
      Creates a LegacyDocument which the document id, JSON content, CAS value, expiration time and status code. This factory method is normally only called within the client library when a response is analyzed and a document is returned which is enriched with the status code. It does not make sense to pre populate the status field from the user level code.
      Parameters:
      id - the per-bucket unique document id.
      expiry - the expiration time of the document.
      content - the content of the document.
      cas - the CAS (compare and swap) value for optimistic concurrency.
      Returns:
      a LegacyDocument.
    • from

      public static LegacyDocument from​(LegacyDocument doc, String id)
      Creates a copy from a different LegacyDocument, but changes the document ID.
      Parameters:
      doc - the original LegacyDocument to copy.
      id - the per-bucket unique document id.
      Returns:
      a copied LegacyDocument with the changed properties.
    • from

      public static LegacyDocument from​(LegacyDocument doc, Object content)
      Creates a copy from a different LegacyDocument, but changes the content.
      Parameters:
      doc - the original LegacyDocument to copy.
      content - the content of the document.
      Returns:
      a copied LegacyDocument with the changed properties.
    • from

      public static LegacyDocument from​(LegacyDocument doc, String id, Object content)
      Creates a copy from a different LegacyDocument, but changes the document ID and content.
      Parameters:
      doc - the original LegacyDocument to copy.
      id - the per-bucket unique document id.
      content - the content of the document.
      Returns:
      a copied LegacyDocument with the changed properties.
    • from

      public static LegacyDocument from​(LegacyDocument doc, long cas)
      Creates a copy from a different LegacyDocument, but changes the CAS value.
      Parameters:
      doc - the original LegacyDocument to copy.
      cas - the CAS (compare and swap) value for optimistic concurrency.
      Returns:
      a copied LegacyDocument with the changed properties.