Class RawJsonDocument
- java.lang.Object
-
- com.couchbase.client.java.document.AbstractDocument<String>
-
- com.couchbase.client.java.document.RawJsonDocument
-
- All Implemented Interfaces:
Document<String>,Serializable
public class RawJsonDocument extends AbstractDocument<String> implements Serializable
Represents aDocumentthat contains a already encoded JSON document. TheRawJsonDocumentcan be used if a custom JSON library is already in place and the content should just be passed through and properly flagged as JSON on the server side. The only transcoding that is happening internally is the conversion into bytes from the provided JSON string.- Since:
- 2.0
- Author:
- Michael Nitschinger
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RawJsonDocumentcreate(String id)Creates aRawJsonDocumentwhich the document id.static RawJsonDocumentcreate(String id, int expiry, String content)Creates aRawJsonDocumentwhich the document id, JSON content and the expiration time.static RawJsonDocumentcreate(String id, int expiry, String content, long cas)Creates aRawJsonDocumentwhich the document id, JSON content, CAS value, expiration time and status code.static RawJsonDocumentcreate(String id, int expiry, String content, long cas, MutationToken mutationToken)Creates aRawJsonDocumentwhich the document id, JSON content, CAS value, expiration time and status code.static RawJsonDocumentcreate(String id, String content)Creates aRawJsonDocumentwhich the document id and JSON content.static RawJsonDocumentcreate(String id, String content, long cas)Creates aRawJsonDocumentwhich the document id, JSON content and the CAS value.static RawJsonDocumentfrom(RawJsonDocument doc, long cas)Creates a copy from a differentRawJsonDocument, but changes the CAS value.static RawJsonDocumentfrom(RawJsonDocument doc, String id, String content)Creates a copy from a differentRawJsonDocument, 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 RawJsonDocument create(String id)
Creates aRawJsonDocumentwhich the document id.- Parameters:
id- the per-bucket unique document id.- Returns:
- a
RawJsonDocument.
-
create
public static RawJsonDocument create(String id, String content)
Creates aRawJsonDocumentwhich the document id and JSON content.- Parameters:
id- the per-bucket unique document id.content- the content of the document.- Returns:
- a
RawJsonDocument.
-
create
public static RawJsonDocument create(String id, String content, long cas)
Creates aRawJsonDocumentwhich 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
RawJsonDocument.
-
create
public static RawJsonDocument create(String id, int expiry, String content)
Creates aRawJsonDocumentwhich the document id, JSON 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
RawJsonDocument.
-
create
public static RawJsonDocument create(String id, int expiry, String content, long cas)
Creates aRawJsonDocumentwhich 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.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
RawJsonDocument.
-
create
public static RawJsonDocument create(String id, int expiry, String content, long cas, MutationToken mutationToken)
Creates aRawJsonDocumentwhich 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.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
RawJsonDocument.
-
from
public static RawJsonDocument from(RawJsonDocument doc, String id, String content)
Creates a copy from a differentRawJsonDocument, but changes the document ID and content.- Parameters:
doc- the originalRawJsonDocumentto copy.id- the per-bucket unique document id.content- the content of the document.- Returns:
- a copied
RawJsonDocumentwith the changed properties.
-
from
public static RawJsonDocument from(RawJsonDocument doc, long cas)
Creates a copy from a differentRawJsonDocument, but changes the CAS value.- Parameters:
doc- the originalRawJsonDocumentto copy.cas- the CAS (compare and swap) value for optimistic concurrency.- Returns:
- a copied
RawJsonDocumentwith the changed properties.
-
-