Class PipelineResult

java.lang.Object
com.google.cloud.firestore.PipelineResult

@InternalExtensionOnly @BetaApi public final class PipelineResult extends Object
A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the getData() or get(String) methods.

If the PipelineResult represents a non-document result, getReference() will return a null value.

Subclassing Note: Firestore classes are not meant to be subclassed except for use in test mocks. Subclassing is not supported in production code and new SDK releases may break code that does so.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(FieldPath fieldPath)
    Returns whether or not the field exists in the document.
    boolean
    Returns whether or not the field exists in the document.
    boolean
    Returns true if the document's data and path in this DocumentSnapshot equals the provided snapshot.
    boolean
    Returns whether or not the field exists in the document.
    get(FieldPath fieldPath)
    Returns the value at the field or null if the field doesn't exist.
    <T> T
    get(FieldPath fieldPath, Class<T> valueType)
    Returns the value at the field, converted to a POJO, or null if the field or result doesn't exist.
    get(String field)
    Returns the value at the field or null if the field doesn't exist.
    <T> T
    get(String field, Class<T> valueType)
    Returns the value at the field, converted to a POJO, or null if the field or result doesn't exist.
    getBlob(String field)
    Returns the value of the field as a Blob.
    Returns the value of the field as a boolean.
    com.google.cloud.Timestamp
    Returns the time at which this document was created.
    Returns the fields of the result as a Map or null if the result doesn't exist.
    getDate(String field)
    Returns the value of the field as a Date.
    Returns the value of the field as a double.
    com.google.cloud.Timestamp
    Returns the time at which the pipeline producing this result is executed.
    Returns the value of the field as a GeoPoint.
    Returns the ID of the document represented by this result.
    getLong(String field)
    Returns the value of the field as a long.
    Gets the reference to the document.
    Returns the value of the field as a String.
    com.google.cloud.Timestamp
    Returns the value of the field as a Timestamp.
    com.google.cloud.Timestamp
    Returns the time at which this document was last updated.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • getId

      @Nullable @BetaApi public String getId()
      Returns the ID of the document represented by this result. Returns null if this result is not corresponding to a Firestore document.
    • getExecutionTime

      @Nullable @BetaApi public com.google.cloud.Timestamp getExecutionTime()
      Returns the time at which the pipeline producing this result is executed.
    • getUpdateTime

      @Nullable @BetaApi public com.google.cloud.Timestamp getUpdateTime()
      Returns the time at which this document was last updated. Returns null if this result is not corresponding to a Firestore document.
    • getCreateTime

      @Nullable @BetaApi public com.google.cloud.Timestamp getCreateTime()
      Returns the time at which this document was created. Returns null if this result is not corresponding to a Firestore document.
    • exists

      @BetaApi public boolean exists()
      Returns whether or not the field exists in the document. Returns false if the document does not exist.
      Returns:
      whether the document existed in this snapshot.
    • getData

      @Nonnull @BetaApi public Map<String,Object> getData()
      Returns the fields of the result as a Map or null if the result doesn't exist. Field values will be converted to their native Java representation.
      Returns:
      The fields of the document as a Map or null if the result doesn't exist.
    • contains

      @BetaApi public boolean contains(@Nonnull String field)
      Returns whether or not the field exists in the document. Returns false if the result does not exist.
      Parameters:
      field - the path to the field.
      Returns:
      true iff the field exists.
    • contains

      @BetaApi public boolean contains(@Nonnull FieldPath fieldPath)
      Returns whether or not the field exists in the document. Returns false if the result does not exist.
      Parameters:
      fieldPath - the path to the field.
      Returns:
      true iff the field exists.
    • get

      @Nullable @BetaApi public Object get(@Nonnull String field)
      Returns the value at the field or null if the field doesn't exist.
      Parameters:
      field - The path to the field.
      Returns:
      The value at the given field or null.
    • get

      @Nullable @BetaApi public <T> T get(@Nonnull String field, @Nonnull Class<T> valueType)
      Returns the value at the field, converted to a POJO, or null if the field or result doesn't exist.
      Parameters:
      field - The path to the field
      valueType - The Java class to convert the field value to.
      Returns:
      The value at the given field or null.
    • get

      @Nullable @BetaApi public Object get(@Nonnull FieldPath fieldPath)
      Returns the value at the field or null if the field doesn't exist.
      Parameters:
      fieldPath - The path to the field.
      Returns:
      The value at the given field or null.
    • get

      @Nullable @BetaApi public <T> T get(@Nonnull FieldPath fieldPath, Class<T> valueType)
      Returns the value at the field, converted to a POJO, or null if the field or result doesn't exist.
      Parameters:
      fieldPath - The path to the field
      valueType - The Java class to convert the field value to.
      Returns:
      The value at the given field or null.
    • getBoolean

      @Nullable @BetaApi public Boolean getBoolean(@Nonnull String field)
      Returns the value of the field as a boolean.
      Parameters:
      field - The path to the field.
      Returns:
      The value of the field.
      Throws:
      RuntimeException - if the value is not a Boolean.
    • getDouble

      @Nullable @BetaApi public Double getDouble(@Nonnull String field)
      Returns the value of the field as a double.
      Parameters:
      field - The path to the field.
      Returns:
      The value of the field.
      Throws:
      RuntimeException - if the value is not a Number.
    • getString

      @Nullable @BetaApi public String getString(@Nonnull String field)
      Returns the value of the field as a String.
      Parameters:
      field - The path to the field.
      Returns:
      The value of the field.
      Throws:
      RuntimeException - if the value is not a String.
    • getLong

      @Nullable @BetaApi public Long getLong(@Nonnull String field)
      Returns the value of the field as a long.
      Parameters:
      field - The path to the field.
      Returns:
      The value of the field.
      Throws:
      RuntimeException - if the value is not a Number.
    • getDate

      @Nullable @BetaApi public Date getDate(@Nonnull String field)
      Returns the value of the field as a Date.
      Parameters:
      field - The path to the field.
      Returns:
      The value of the field.
      Throws:
      RuntimeException - if the value is not a Date.
    • getTimestamp

      @Nullable @BetaApi public com.google.cloud.Timestamp getTimestamp(@Nonnull String field)
      Returns the value of the field as a Timestamp.
      Parameters:
      field - The path to the field.
      Returns:
      The value of the field.
      Throws:
      RuntimeException - if the value is not a Date.
    • getBlob

      @Nullable @BetaApi public Blob getBlob(@Nonnull String field)
      Returns the value of the field as a Blob.
      Parameters:
      field - The path to the field.
      Returns:
      The value of the field.
      Throws:
      RuntimeException - if the value is not a Blob.
    • getGeoPoint

      @Nullable @BetaApi public GeoPoint getGeoPoint(@Nonnull String field)
      Returns the value of the field as a GeoPoint.
      Parameters:
      field - The path to the field.
      Returns:
      The value of the field.
      Throws:
      RuntimeException - if the value is not a GeoPoint.
    • getReference

      @BetaApi public DocumentReference getReference()
      Gets the reference to the document.
      Returns:
      The reference to the document.
    • equals

      @BetaApi public boolean equals(Object obj)
      Returns true if the document's data and path in this DocumentSnapshot equals the provided snapshot.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare against.
      Returns:
      Whether this DocumentSnapshot is equal to the provided object.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object