Class StringDocument
- java.lang.Object
-
- com.couchbase.client.java.document.AbstractDocument<String>
-
- com.couchbase.client.java.document.StringDocument
-
- All Implemented Interfaces:
Document<String>,Serializable
public class StringDocument extends AbstractDocument<String> implements Serializable
Handles a raw string as the document value. This document differs fromJsonStringDocumentin 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.- Since:
- 2.0
- Author:
- Michael Nitschinger
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringDocumentcreate(String id)Creates aStringDocumentwhich the document id.static StringDocumentcreate(String id, int expiry, String content)Creates aStringDocumentwhich the document id, content and the expiration time.static StringDocumentcreate(String id, int expiry, String content, long cas)Creates aStringDocumentwhich the document id, content, CAS value, expiration time and status code.static StringDocumentcreate(String id, int expiry, String content, long cas, MutationToken mutationToken)Creates aStringDocumentwhich the document id, content, CAS value, expiration time and status code.static StringDocumentcreate(String id, String content)Creates aStringDocumentwhich the document id and content.static StringDocumentcreate(String id, String content, long cas)Creates aStringDocumentwhich the document id, content and the CAS value.static StringDocumentfrom(StringDocument doc, long cas)Creates a copy from a differentStringDocument, but changes the CAS value.static StringDocumentfrom(StringDocument doc, String id, String content)Creates a copy from a differentStringDocument, 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 StringDocument create(String id)
Creates aStringDocumentwhich the document id.- Parameters:
id- the per-bucket unique document id.- Returns:
- a
StringDocument.
-
create
public static StringDocument create(String id, String content)
Creates aStringDocumentwhich the document id and content.- Parameters:
id- the per-bucket unique document id.content- the content of the document.- Returns:
- a
StringDocument.
-
create
public static StringDocument create(String id, String content, long cas)
Creates aStringDocumentwhich the document id, 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
StringDocument.
-
create
public static StringDocument create(String id, int expiry, String content)
Creates aStringDocumentwhich the document id, content and the expiration time.- Parameters:
id- the per-bucket unique document id.content- the content of the document.expiry- the expiration time of the document.- Returns:
- a
StringDocument.
-
create
public static StringDocument create(String id, int expiry, String content, long cas)
Creates aStringDocumentwhich 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.- Parameters:
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.- Returns:
- a
StringDocument.
-
create
public static StringDocument create(String id, int expiry, String content, long cas, MutationToken mutationToken)
Creates aStringDocumentwhich 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.- Parameters:
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.- Returns:
- a
StringDocument.
-
from
public static StringDocument from(StringDocument doc, String id, String content)
Creates a copy from a differentStringDocument, but changes the document ID and content.- Parameters:
doc- the originalStringDocumentto copy.id- the per-bucket unique document id.content- the content of the document.- Returns:
- a copied
StringDocumentwith the changed properties.
-
from
public static StringDocument from(StringDocument doc, long cas)
Creates a copy from a differentStringDocument, but changes the CAS value.- Parameters:
doc- the originalStringDocumentto copy.cas- the CAS (compare and swap) value for optimistic concurrency.- Returns:
- a copied
StringDocumentwith the changed properties.
-
-