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
Modifier and Type Method Description static LegacyDocument
create(String id)
Creates aLegacyDocument
which the document id.static LegacyDocument
create(String id, int expiry, Object content)
Creates aLegacyDocument
which the document id, JSON content and the expiration time.static LegacyDocument
create(String id, int expiry, Object content, long cas)
Creates aLegacyDocument
which the document id, JSON content, CAS value, expiration time and status code.static LegacyDocument
create(String id, int expiry, Object content, long cas, MutationToken mutationToken)
Creates aLegacyDocument
which the document id, JSON content, CAS value, expiration time and status code.static LegacyDocument
create(String id, Object content)
Creates aLegacyDocument
which the document id and JSON content.static LegacyDocument
create(String id, Object content, long cas)
Creates aLegacyDocument
which the document id, JSON content and the CAS value.static LegacyDocument
from(LegacyDocument doc, long cas)
Creates a copy from a differentLegacyDocument
, but changes the CAS value.static LegacyDocument
from(LegacyDocument doc, Object content)
Creates a copy from a differentLegacyDocument
, but changes the content.static LegacyDocument
from(LegacyDocument doc, String id)
Creates a copy from a differentLegacyDocument
, but changes the document ID.static LegacyDocument
from(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 Details
-
create
Creates aLegacyDocument
which the document id.- Parameters:
id
- the per-bucket unique document id.- Returns:
- a
LegacyDocument
.
-
create
Creates aLegacyDocument
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
Creates aLegacyDocument
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
Creates aLegacyDocument
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
Creates aLegacyDocument
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 aLegacyDocument
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
Creates a copy from a differentLegacyDocument
, but changes the document ID.- Parameters:
doc
- the originalLegacyDocument
to copy.id
- the per-bucket unique document id.- Returns:
- a copied
LegacyDocument
with the changed properties.
-
from
Creates a copy from a differentLegacyDocument
, but changes the content.- Parameters:
doc
- the originalLegacyDocument
to copy.content
- the content of the document.- Returns:
- a copied
LegacyDocument
with the changed properties.
-
from
Creates a copy from a differentLegacyDocument
, but changes the document ID and content.- Parameters:
doc
- the originalLegacyDocument
to copy.id
- the per-bucket unique document id.content
- the content of the document.- Returns:
- a copied
LegacyDocument
with the changed properties.
-
from
Creates a copy from a differentLegacyDocument
, but changes the CAS value.- Parameters:
doc
- the originalLegacyDocument
to copy.cas
- the CAS (compare and swap) value for optimistic concurrency.- Returns:
- a copied
LegacyDocument
with the changed properties.
-