Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class DocumentSnapshot

  1. Object
  2. 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

public static DocumentSnapshot fromJson(Map doc)Builds a snapshot from a REST Document object.
public boolean exists()
public String getName()
public String getId()
public String getPath()
public Map<String, Object> getData()
public Object get(String field)Reads one top-level field.
public String getUpdateTime()
public String getCreateTime()
public String toString()Returns a string representation of the object.

Inherited methods

Constructor details

DocumentSnapshot

public DocumentSnapshot(String name, Map<String, Object> data, String createTime, String updateTime)
Creates a snapshot.

Parameters

name String
the full resource name
data Map<String, Object>
the decoded fields, or null when the document does not exist
createTime String
the server create time, may be null
updateTime String
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

doc Map
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/SF

getData

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

field String
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())