Class DocumentRef<T>


  • public class DocumentRef<T>
    extends Object
    Provides an Document Reference class.
    • Method Detail

      • getKey

        public Key getKey()
        Return the document's key.
        Returns:
        the document's key
      • get

        public T get()
        Return the collection document reference value.
        Returns:
        the collection document reference value, or null if not found
      • set

        public void set​(T content)
        Set the document content for this document reference in the database. If the document does not exist an new item will be created, otherwise an existing document will be update with the new value.
        Parameters:
        content - the document content to store (required)
      • delete

        public void delete()
        Delete this document reference from the database if it exists.
      • collection

        public Collection collection​(String name)
        Create a new sub collection under this document.
        Parameters:
        name - the name of the sub collection (required)
        Returns:
        a new sub collection for the parent collection
      • query

        public Query<Map> query​(String name)
        Create a new sub collection query for this Document Ref. The query object will have a Map value type.
        Parameters:
        name - the name of the sub collection (required)
        Returns:
        a new collection query object
      • query

        public <K> Query<K> query​(String name,
                                  Class<K> type)
        Create a new sub collection query for this Document Ref, and with the given value type.
        Parameters:
        name - the name of the sub collection (required)
        type - the query value type (required)
        Returns:
        a new collection query object
      • toString

        public String toString()
        Return the string representation of this object.
        Overrides:
        toString in class Object
        Returns:
        the string representation of this object