public class Document extends Resource
A document is a structured JSON document. There is no set schema for the JSON documents, and a document may contain any number of custom properties as well as an optional list of attachments. Document is an application resource and can be authorized using the master key or resource keys.
Constructor and Description |
---|
Document()
Initialize a document object.
|
Document(org.json.JSONObject jsonObject)
Initialize a document object from json object.
|
Document(String jsonString)
Initialize a document object from json string.
|
Document(String jsonString,
com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Initialize a document object from json string.
|
Modifier and Type | Method and Description |
---|---|
Integer |
getTimeToLive()
Gets the document's time-to-live value.
|
void |
setTimeToLive(Integer timeToLive)
Sets the document's time-to-live value.
|
getETag, getId, getResourceId, getSelfLink, getTimestamp, setId, setResourceId
get, getBoolean, getCollection, getCollection, getDouble, getHashMap, getInt, getLogger, getLong, getMapper, getObject, getObject, getObjectByPath, getString, has, remove, set, toJson, toJson, toObject, toString
public Document()
public Document(String jsonString, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
jsonString
- the json string that represents the document object.objectMapper
- the custom object mapperpublic Document(String jsonString)
jsonString
- the json string that represents the document object.public Document(org.json.JSONObject jsonObject)
jsonObject
- the json object that represents the document object.public Integer getTimeToLive()
public void setTimeToLive(Integer timeToLive)
A document's time-to-live value is an optional property. If set, the document expires after the specified number of seconds since its last write time. The value of this property should be one of the following:
null - indicates the time-to-live value for this document inherits from the parent collection's default time-to-live value.
nonzero positive integer - indicates the number of seconds before the document expires. It overrides the default time-to-live value specified on the parent collection, unless the parent collection's default time-to-live is null.
-1 - indicates the document never expires. It overrides the default time-to-live value specified on the parent collection, unless the parent collection's default time-to-live is null.
timeToLive
- the document's time-to-live value in seconds.Copyright © 2018. All rights reserved.