public final class Document
extends java.lang.Object
You can set, get and modify this value.
To obtain an instance of a Document use SyncClient.openDocument(com.twilio.sync.Options, com.twilio.sync.DocumentObserver, com.twilio.sync.SuccessListener<com.twilio.sync.Document>)
.
Modifier and Type | Class and Description |
---|---|
static class |
Document.Metadata |
Modifier and Type | Field and Description |
---|---|
int |
InfiniteDuration
Time to live for a document, specifying no expiry.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
org.json.JSONObject |
getData()
Get value of the document as a JSON object.
|
java.lang.String |
getSid()
Retrieves a machine-generated unique identifier for this Document.
|
java.lang.String |
getUniqueName()
Retrieves a user-set unique name for this Document.
|
void |
mutateData(Mutator mutator,
Document.Metadata metadata,
SuccessListener<org.json.JSONObject> listener)
Mutate value of the document using provided Mutator function.
|
void |
mutateData(Mutator mutator,
SuccessListener<org.json.JSONObject> listener)
Mutate value of the document using provided Mutator function.
|
void |
removeDocument(SuccessListener<java.lang.Void> listener)
Remove document.
|
void |
setData(org.json.JSONObject data,
Document.Metadata metadata,
SuccessListener<org.json.JSONObject> listener)
Set value of the document as a JSON object.
|
void |
setData(org.json.JSONObject data,
SuccessListener<org.json.JSONObject> listener)
Set value of the document as a JSON object.
|
void |
setTtl(int ttl,
SuccessListener<java.lang.Void> listener)
Update the document’s time to live.
|
public final int InfiniteDuration
public java.lang.String getSid()
public java.lang.String getUniqueName()
public org.json.JSONObject getData()
public void setData(org.json.JSONObject data, SuccessListener<org.json.JSONObject> listener)
metadata
.data
- New document data.listener
- Async result listener. See SuccessListener
.public void setData(org.json.JSONObject data, Document.Metadata metadata, SuccessListener<org.json.JSONObject> listener)
data
- New document data.metadata
- Optional metadata for the updated document, currently only ttl.listener
- Async result listener. See SuccessListener
.public void mutateData(Mutator mutator, SuccessListener<org.json.JSONObject> listener)
metadata
.mutator
- Mutator which will be applied to document data.listener
- Async result listener. See SuccessListener
.public void mutateData(Mutator mutator, Document.Metadata metadata, SuccessListener<org.json.JSONObject> listener)
mutator
- Mutator which will be applied to document data.metadata
- Optional metadata for the updated document, currently only ttl.listener
- Async result listener. See SuccessListener
.public void setTtl(int ttl, SuccessListener<java.lang.Void> listener)
ttl
- The new time to live for this document in seconds from now
or Document.InfiniteDuration to indicate no expiry.listener
- Async result listener. See SuccessListener
.public void removeDocument(SuccessListener<java.lang.Void> listener)
listener
- Async result listener. See SuccessListener
.public void dispose()