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.
Modifier and Type | Method and Description |
---|---|
static LegacyDocument |
create(String id)
Creates a
LegacyDocument which the document id. |
static LegacyDocument |
create(String id,
int expiry,
Object content)
Creates a
LegacyDocument which the document id, JSON content and the expiration time. |
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. |
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. |
static LegacyDocument |
create(String id,
Object content)
Creates a
LegacyDocument which the document id and JSON content. |
static LegacyDocument |
create(String id,
Object content,
long cas)
Creates a
LegacyDocument which the document id, JSON content and the CAS value. |
static LegacyDocument |
from(LegacyDocument doc,
long cas)
Creates a copy from a different
LegacyDocument , but changes the CAS value. |
static LegacyDocument |
from(LegacyDocument doc,
Object content)
Creates a copy from a different
LegacyDocument , but changes the content. |
static LegacyDocument |
from(LegacyDocument doc,
String id)
Creates a copy from a different
LegacyDocument , but changes the document ID. |
static LegacyDocument |
from(LegacyDocument doc,
String id,
Object content)
Creates a copy from a different
LegacyDocument , but changes the document ID and content. |
cas, content, equals, expiry, hashCode, id, mutationToken, readFromSerializedStream, toString, writeToSerializedStream
public static LegacyDocument create(String id)
Creates a LegacyDocument
which the document id.
id
- the per-bucket unique document id.LegacyDocument
.public static LegacyDocument create(String id, Object content)
Creates a LegacyDocument
which the document id and JSON content.
id
- the per-bucket unique document id.content
- the content of the document.LegacyDocument
.public static LegacyDocument create(String id, Object content, long cas)
Creates a LegacyDocument
which the document id, JSON content and the CAS value.
id
- the per-bucket unique document id.content
- the content of the document.cas
- the CAS (compare and swap) value for optimistic concurrency.LegacyDocument
.public static LegacyDocument create(String id, int expiry, Object content)
Creates a LegacyDocument
which the document id, JSON content and the expiration time.
id
- the per-bucket unique document id.expiry
- the expiration time of the document.content
- the content of the document.LegacyDocument
.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.
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.LegacyDocument
.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.
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.LegacyDocument
.public static LegacyDocument from(LegacyDocument doc, String id)
Creates a copy from a different LegacyDocument
, but changes the document ID.
doc
- the original LegacyDocument
to copy.id
- the per-bucket unique document id.LegacyDocument
with the changed properties.public static LegacyDocument from(LegacyDocument doc, Object content)
Creates a copy from a different LegacyDocument
, but changes the content.
doc
- the original LegacyDocument
to copy.content
- the content of the document.LegacyDocument
with the changed properties.public static LegacyDocument from(LegacyDocument doc, String id, Object content)
Creates a copy from a different LegacyDocument
, but changes the document ID and content.
doc
- the original LegacyDocument
to copy.id
- the per-bucket unique document id.content
- the content of the document.LegacyDocument
with the changed properties.public static LegacyDocument from(LegacyDocument doc, long cas)
Creates a copy from a different LegacyDocument
, but changes the CAS value.
doc
- the original LegacyDocument
to copy.cas
- the CAS (compare and swap) value for optimistic concurrency.LegacyDocument
with the changed properties.Copyright © 2015 Couchbase, Inc.