public class StringDocument extends AbstractDocument<java.lang.String>
Handles a raw string as the document value.
This document differs from JsonStringDocument
in that it is not automatically quoted and stored as-is on the server side. The server will potentially not identify it is as a string if manual quotes are not added by the application itself. It is compatible with legacy strings stored.
Modifier and Type | Method and Description |
---|---|
static StringDocument |
create(java.lang.String id)
Creates a
StringDocument which the document id. |
static StringDocument |
create(java.lang.String id,
int expiry,
java.lang.String content)
Creates a
StringDocument which the document id, content and the expiration time. |
static StringDocument |
create(java.lang.String id,
int expiry,
java.lang.String content,
long cas)
Creates a
StringDocument which the document id, content, CAS value, expiration time and status code. |
static StringDocument |
create(java.lang.String id,
java.lang.String content)
Creates a
StringDocument which the document id and content. |
static StringDocument |
create(java.lang.String id,
java.lang.String content,
long cas)
Creates a
StringDocument which the document id, content and the CAS value. |
static StringDocument |
empty()
Creates a empty
StringDocument . |
static StringDocument |
from(StringDocument doc,
long cas)
Creates a copy from a different
StringDocument , but changes the CAS value. |
static StringDocument |
from(StringDocument doc,
java.lang.String id,
java.lang.String content)
Creates a copy from a different
StringDocument , but changes the document ID and content. |
public static StringDocument empty()
Creates a empty StringDocument
.
StringDocument
.public static StringDocument create(java.lang.String id)
Creates a StringDocument
which the document id.
id
- the per-bucket unique document id.StringDocument
.public static StringDocument create(java.lang.String id, java.lang.String content)
Creates a StringDocument
which the document id and content.
id
- the per-bucket unique document id.content
- the content of the document.StringDocument
.public static StringDocument create(java.lang.String id, java.lang.String content, long cas)
Creates a StringDocument
which the document id, 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.StringDocument
.public static StringDocument create(java.lang.String id, int expiry, java.lang.String content)
Creates a StringDocument
which the document id, content and the expiration time.
id
- the per-bucket unique document id.content
- the content of the document.expiry
- the expiration time of the document.StringDocument
.public static StringDocument create(java.lang.String id, int expiry, java.lang.String content, long cas)
Creates a StringDocument
which the document id, 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.content
- the content of the document.cas
- the CAS (compare and swap) value for optimistic concurrency.expiry
- the expiration time of the document.StringDocument
.public static StringDocument from(StringDocument doc, java.lang.String id, java.lang.String content)
Creates a copy from a different StringDocument
, but changes the document ID and content.
doc
- the original StringDocument
to copy.id
- the per-bucket unique document id.content
- the content of the document.StringDocument
with the changed properties.public static StringDocument from(StringDocument doc, long cas)
Creates a copy from a different StringDocument
, but changes the CAS value.
doc
- the original StringDocument
to copy.cas
- the CAS (compare and swap) value for optimistic concurrency.StringDocument
with the changed properties.