public class BasicDocumentRevision extends java.lang.Object implements DocumentRevision, java.lang.Comparable<BasicDocumentRevision>
Modifier and Type | Method and Description |
---|---|
byte[] |
asBytes()
Returns the JSON body of the document revision as a
byte
array. |
java.util.Map<java.lang.String,java.lang.Object> |
asMap()
Returns the JSON body of the document revision as a
Map
object. |
int |
compareTo(BasicDocumentRevision o) |
boolean |
equals(java.lang.Object that) |
java.util.Map<java.lang.String,Attachment> |
getAttachments() |
DocumentBody |
getBody() |
int |
getGeneration() |
java.lang.String |
getId() |
long |
getParent()
Returns the sequence number of this revision's parent revision.
|
java.lang.String |
getRevision() |
long |
getSequence()
Returns the sequence number of this revision.
|
int |
hashCode() |
void |
initialiseSequence(long sequence) |
boolean |
isCurrent() |
boolean |
isDeleted() |
MutableDocumentRevision |
mutableCopy()
Return a mutable copy of this
DocumentRevision . |
void |
setDeleted(boolean deleted) |
void |
setId(java.lang.String id) |
void |
setRevision(java.lang.String revision) |
java.lang.String |
toString() |
public java.lang.String getId()
getId
in interface DocumentRevision
public void setId(java.lang.String id)
public java.lang.String getRevision()
getRevision
in interface DocumentRevision
public void setRevision(java.lang.String revision)
public DocumentBody getBody()
getBody
in interface DocumentRevision
DocumentBody
of the documentpublic boolean isCurrent()
true
if this revision is the current winner for the
document.public long getParent()
Returns the sequence number of this revision's parent revision.
If this number is less than or equal to zero, it means this revision is the root of a document tree. A document may have more than one tree, under certain circumstances, such as two documents with the same ID being created in different datastores that are later replicated across.
public java.util.Map<java.lang.String,java.lang.Object> asMap()
Returns the JSON body of the document revision as a Map
object.
This Map includes reserved fields such as _id
and
_rev
. Changing the byte array may affect the DocumentRevision
,
as only a shallow copy is returned.
Map
object.public byte[] asBytes()
Returns the JSON body of the document revision as a byte
array.
This byte array includes reserved fields such as _id
and
_rev
. Changing the byte array does not affect the document
revisions contents.
byte
array.public boolean isDeleted()
true
if this revision is marked deleted.public void setDeleted(boolean deleted)
public long getSequence()
Returns the sequence number of this revision.
The sequence number is unique across the database, it is updated for every modification to the datastore.
public void initialiseSequence(long sequence)
public java.lang.String toString()
toString
in class java.lang.Object
public int getGeneration()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object that)
equals
in class java.lang.Object
public int compareTo(BasicDocumentRevision o)
compareTo
in interface java.lang.Comparable<BasicDocumentRevision>
public MutableDocumentRevision mutableCopy()
Return a mutable copy of this DocumentRevision
.
The mutable copy can be used to change the body and attachments.
Mutable copies can be created or updated in the datastore by calling the appropriate
methods on the Datastore
Datastore.createDocumentFromRevision(MutableDocumentRevision)
,
Datastore.updateDocumentFromRevision(MutableDocumentRevision)
public java.util.Map<java.lang.String,Attachment> getAttachments()
getAttachments
in interface DocumentRevision