Class SerializableDocument
- java.lang.Object
-
- com.couchbase.client.java.document.AbstractDocument<Serializable>
-
- com.couchbase.client.java.document.SerializableDocument
-
- All Implemented Interfaces:
Document<Serializable>,Serializable
public class SerializableDocument extends AbstractDocument<Serializable> implements Serializable
Handles content which implementsSerializable. This document is not interoperable with other SDKs, since java object serialization is not convertible into other programming languages. It is compatible with the legacy object serialization from the 1.* SDK series.- Since:
- 2.0
- Author:
- Michael Nitschinger
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SerializableDocumentcreate(String id)Creates aSerializableDocumentwhich the document id.static SerializableDocumentcreate(String id, int expiry, Serializable content)Creates aSerializableDocumentwhich the document id, content and the expiration time.static SerializableDocumentcreate(String id, int expiry, Serializable content, long cas)Creates aSerializableDocumentwhich the document id, content, CAS value, expiration time and status code.static SerializableDocumentcreate(String id, int expiry, Serializable content, long cas, MutationToken mutationToken)Creates aSerializableDocumentwhich the document id, content, CAS value, expiration time and status code.static SerializableDocumentcreate(String id, Serializable content)Creates aSerializableDocumentwhich the document id and content.static SerializableDocumentcreate(String id, Serializable content, long cas)Creates aSerializableDocumentwhich the document id, content and the CAS value.static SerializableDocumentfrom(SerializableDocument doc, long cas)Creates a copy from a differentSerializableDocument, but changes the CAS value.static SerializableDocumentfrom(SerializableDocument doc, Long content)Creates a copy from a differentSerializableDocument, but changes the content.static SerializableDocumentfrom(SerializableDocument doc, String id)Creates a copy from a differentSerializableDocument, but changes the document ID.static SerializableDocumentfrom(SerializableDocument doc, String id, Long content)Creates a copy from a differentSerializableDocument, 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 SerializableDocument create(String id)
Creates aSerializableDocumentwhich the document id.- Parameters:
id- the per-bucket unique document id.- Returns:
- a
SerializableDocument.
-
create
public static SerializableDocument create(String id, Serializable content)
Creates aSerializableDocumentwhich the document id and content.- Parameters:
id- the per-bucket unique document id.content- the content of the document.- Returns:
- a
SerializableDocument.
-
create
public static SerializableDocument create(String id, Serializable content, long cas)
Creates aSerializableDocumentwhich 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
SerializableDocument.
-
create
public static SerializableDocument create(String id, int expiry, Serializable content)
Creates aSerializableDocumentwhich 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
SerializableDocument.
-
create
public static SerializableDocument create(String id, int expiry, Serializable content, long cas)
Creates aSerializableDocumentwhich 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
SerializableDocument.
-
create
public static SerializableDocument create(String id, int expiry, Serializable content, long cas, MutationToken mutationToken)
Creates aSerializableDocumentwhich 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
SerializableDocument.
-
from
public static SerializableDocument from(SerializableDocument doc, String id)
Creates a copy from a differentSerializableDocument, but changes the document ID.- Parameters:
doc- the originalSerializableDocumentto copy.id- the per-bucket unique document id.- Returns:
- a copied
SerializableDocumentwith the changed properties.
-
from
public static SerializableDocument from(SerializableDocument doc, Long content)
Creates a copy from a differentSerializableDocument, but changes the content.- Parameters:
doc- the originalSerializableDocumentto copy.content- the content of the document.- Returns:
- a copied
SerializableDocumentwith the changed properties.
-
from
public static SerializableDocument from(SerializableDocument doc, String id, Long content)
Creates a copy from a differentSerializableDocument, but changes the document ID and content.- Parameters:
doc- the originalSerializableDocumentto copy.id- the per-bucket unique document id.content- the content of the document.- Returns:
- a copied
SerializableDocumentwith the changed properties.
-
from
public static SerializableDocument from(SerializableDocument doc, long cas)
Creates a copy from a differentSerializableDocument, but changes the CAS value.- Parameters:
doc- the originalSerializableDocumentto copy.cas- the CAS (compare and swap) value for optimistic concurrency.- Returns:
- a copied
SerializableDocumentwith the changed properties.
-
-