public interface DocumentSnapshot
The diffing package depends on the ordering of snapshots, which
must match the order of their appearance in the
SnapshotRepository
. By default the ordering of snapshots is
determined by the lexicographic ordering of their document IDs (the
natural order of Java String
values).
Since version 3.0.6, the DocumentSnapshot
implementation
class can also implement Comparable
. The diffing package
will check for the Comparable
implementation before
comparing the document IDs. Reasons to implement Comparable
to define the details of the ordering include the lexicographic
ordering of the document IDs, and the encoding required to make the
document IDs safe to use in URLs, which might not be an
order-preserving encoding (e.g., Base64 is not order-preserving).
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDocumentId()
Returns the unique ID for the document.
|
DocumentHandle |
getUpdate(DocumentSnapshot onGsa)
Returns a
DocumentHandle for updating the referenced
document on the GSA or null if the document on the GSA
does not need updating. |
java.lang.String |
toString()
Returns a serialized
String representation of this
DocumentSnapshot suitable for deserialization with
DocumentSnapshotFactory.fromString(String) . |
java.lang.String getDocumentId()
DocumentHandle getUpdate(DocumentSnapshot onGsa) throws RepositoryException
DocumentHandle
for updating the referenced
document on the GSA or null
if the document on the GSA
does not need updating.
The diffing framework will call this before calling
toString()
to persist this DocumentSnapshot
.
onGsa
- a DocumentSnapshot
representing the GSA's version
of the documentDocumentHandle
representing the change required by
the GSA to bring the document up-to-date; or null
if the GSA's knowledge of the document is up-to-dateRepositoryException
java.lang.String toString()
String
representation of this
DocumentSnapshot
suitable for deserialization with
DocumentSnapshotFactory.fromString(String)
.
The returned value must not be null
.toString
in class java.lang.Object