Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class DocumentSnapshot
- Object
- DocumentSnapshot
An immutable copy of one Firestore document as the server returned it.
Constructors
public DocumentSnapshot(String name, Map<String, Object> data, String createTime, String updateTime) | Creates a snapshot. |
Methods
Inherited methods
Constructor details
DocumentSnapshot
public DocumentSnapshot(String name, Map<String, Object> data, String createTime, String updateTime)Creates a snapshot.
Parameters
nameString- the full resource name
dataMap<String, Object>- the decoded fields, or null when the document does not exist
createTimeString- the server create time, may be null
updateTimeString- the server update time, may be null
Method details
fromJson
public static DocumentSnapshot fromJson(Map doc)Builds a snapshot from a REST
Document object.Parameters
docMap- the parsed JSON document
Returns
the snapshot
exists
public boolean exists()Returns
true when the document exists
getName
public String getName()Returns
the full resource name
getId
public String getId()Returns
the last path segment, the document ID
getPath
public String getPath()Returns
the path relative to the database root, such as
cities/SFgetData
public Map<String, Object> getData()Returns
the decoded fields, or null when the document does not exist
get
public Object get(String field)Reads one top-level field.
Parameters
fieldString- the field name
Returns
the value, or null
getUpdateTime
public String getUpdateTime()Returns
the RFC 3339 update time, or null
getCreateTime
public String getCreateTime()Returns
the RFC 3339 create time, or null
toString
public String toString()Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + ‘@’ + Integer.toHexString(hashCode())