Class LegacyDocument
- java.lang.Object
-
- com.couchbase.client.java.document.AbstractDocument<Object>
-
- com.couchbase.client.java.document.LegacyDocument
-
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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LegacyDocumentcreate(String id)Creates aLegacyDocumentwhich the document id.static LegacyDocumentcreate(String id, int expiry, Object content)Creates aLegacyDocumentwhich the document id, JSON content and the expiration time.static LegacyDocumentcreate(String id, int expiry, Object content, long cas)Creates aLegacyDocumentwhich the document id, JSON content, CAS value, expiration time and status code.static LegacyDocumentcreate(String id, int expiry, Object content, long cas, MutationToken mutationToken)Creates aLegacyDocumentwhich the document id, JSON content, CAS value, expiration time and status code.static LegacyDocumentcreate(String id, Object content)Creates aLegacyDocumentwhich the document id and JSON content.static LegacyDocumentcreate(String id, Object content, long cas)Creates aLegacyDocumentwhich the document id, JSON content and the CAS value.static LegacyDocumentfrom(LegacyDocument doc, long cas)Creates a copy from a differentLegacyDocument, but changes the CAS value.static LegacyDocumentfrom(LegacyDocument doc, Object content)Creates a copy from a differentLegacyDocument, but changes the content.static LegacyDocumentfrom(LegacyDocument doc, String id)Creates a copy from a differentLegacyDocument, but changes the document ID.static LegacyDocumentfrom(LegacyDocument doc, String id, Object content)Creates a copy from a differentLegacyDocument, but changes the document ID and content.-
Methods inherited from class com.couchbase.client.java.document.AbstractDocument
cas, content, equals, expiry, hashCode, id, mutationToken, readFromSerializedStream, toString, writeToSerializedStream
-
-
-
-
Method Detail
-
create
public static LegacyDocument create(String id)
Creates aLegacyDocumentwhich the document id.- Parameters:
id- the per-bucket unique document id.- Returns:
- a
LegacyDocument.
-
create
public static LegacyDocument create(String id, Object content)
Creates aLegacyDocumentwhich 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 aLegacyDocumentwhich 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 aLegacyDocumentwhich 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 aLegacyDocumentwhich 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 aLegacyDocumentwhich 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 differentLegacyDocument, but changes the document ID.- Parameters:
doc- the originalLegacyDocumentto copy.id- the per-bucket unique document id.- Returns:
- a copied
LegacyDocumentwith the changed properties.
-
from
public static LegacyDocument from(LegacyDocument doc, Object content)
Creates a copy from a differentLegacyDocument, but changes the content.- Parameters:
doc- the originalLegacyDocumentto copy.content- the content of the document.- Returns:
- a copied
LegacyDocumentwith the changed properties.
-
from
public static LegacyDocument from(LegacyDocument doc, String id, Object content)
Creates a copy from a differentLegacyDocument, but changes the document ID and content.- Parameters:
doc- the originalLegacyDocumentto copy.id- the per-bucket unique document id.content- the content of the document.- Returns:
- a copied
LegacyDocumentwith the changed properties.
-
from
public static LegacyDocument from(LegacyDocument doc, long cas)
Creates a copy from a differentLegacyDocument, but changes the CAS value.- Parameters:
doc- the originalLegacyDocumentto copy.cas- the CAS (compare and swap) value for optimistic concurrency.- Returns:
- a copied
LegacyDocumentwith the changed properties.
-
-