public abstract class AbstractDocument<T> extends Object implements Document<T>
Document.
It is recommended that all Document implementations extend from this class so that parameter checks
are consistently applied. It also ensures that equals and hashcode are applied on the contents and therefore
comparisons work as expected.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDocument()
Constructor needed for possible subclass serialization.
|
protected |
AbstractDocument(String id,
int expiry,
T content,
long cas) |
protected |
AbstractDocument(String id,
int expiry,
T content,
long cas,
MutationToken mutationToken) |
| Modifier and Type | Method and Description |
|---|---|
long |
cas()
The last-known CAS value for the
Document (0 if not set). |
T |
content()
The content of the
Document. |
boolean |
equals(Object o) |
int |
expiry()
The optional expiration time for the
Document (0 if not set). |
int |
hashCode() |
String |
id()
The per-bucket unique ID of the
Document. |
MutationToken |
mutationToken()
The optional, opaque mutation token set after a successful mutation and if enabled on
the environment.
|
protected void |
readFromSerializedStream(ObjectInputStream stream)
Helper method to create the document from an object input stream, used for serialization purposes.
|
String |
toString() |
protected void |
writeToSerializedStream(ObjectOutputStream stream)
Helper method to write the current document state to the output stream for serialization purposes.
|
protected AbstractDocument()
protected AbstractDocument(String id, int expiry, T content, long cas, MutationToken mutationToken)
public String id()
DocumentDocument.public long cas()
DocumentDocument (0 if not set).public int expiry()
DocumentDocument (0 if not set).public MutationToken mutationToken()
DocumentmutationToken in interface Document<T>protected void writeToSerializedStream(ObjectOutputStream stream) throws IOException
stream - the stream to write to.IOExceptionprotected void readFromSerializedStream(ObjectInputStream stream) throws IOException, ClassNotFoundException
stream - the stream to read from.IOExceptionClassNotFoundExceptionCopyright © 2015 Couchbase, Inc.