Enum Class Database.Collections

java.lang.Object
java.lang.Enum<Database.Collections>
com.syzygy.events.database.Database.Collections
All Implemented Interfaces:
Serializable, Comparable<Database.Collections>, Constable
Enclosing class:
Database

public static enum Database.Collections extends Enum<Database.Collections>
Contains the different collections stored in the database;
  • Enum Constant Details

  • Field Details

    • dbIdentifier

      private final String dbIdentifier
      The Firestore identifier for the collection
    • DOES_NOT_HAVE_ASSOCIATED_IMAGE

      public static final int DOES_NOT_HAVE_ASSOCIATED_IMAGE
      See Also:
    • IS_ITS_OWN_ASSOCIATED_IMAGE

      public static final int IS_ITS_OWN_ASSOCIATED_IMAGE
      See Also:
  • Constructor Details

    • Collections

      private Collections()
  • Method Details

    • values

      public static Database.Collections[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Database.Collections valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getDatabaseID

      public String getDatabaseID(@Observes DatabaseInstance<?> instance)
      Returns a unique identifier for the instance within the full database
      Parameters:
      instance - The database instance
      Returns:
      The unique database identifier
    • getDatabaseID

      public String getDatabaseID(String documentID)
      Returns a unique identifier for the instance within the full database
      Parameters:
      documentID - The unique identifier of the instance within the collection
      Returns:
      The unique database identifier
    • instanceIDFromDatabaseID

      public String instanceIDFromDatabaseID(String databaseID)
      Gets the instance id from the database id
      Parameters:
      databaseID - The unique identifier of the instance within the database
      Returns:
      The unique identifier of the instance within the collection
    • getCollectionID

      public String getCollectionID()
      Returns the document ID
      Returns:
      The document ID
    • getCollection

      public com.google.firebase.firestore.CollectionReference getCollection(Database db)
      Returns the database collection object
      Parameters:
      db - The database
      Returns:
      The CollectionReference for the collection
    • getDocument

      public com.google.firebase.firestore.DocumentReference getDocument(Database db, String documentID)
      Gets the document within the collection. If no document exists, creates a new document.
      Parameters:
      db - The database
      documentID - The document identifier within the collection
      Returns:
      The DocumentReference for the document
    • getNewID

      String getNewID(Database db)
      Parameters:
      db - The database
      Returns:
      A new unique id for the collection
    • newInstance

      @NonNull @Salty <T extends DatabaseInstance<T>> DatabaseInstance<T> newInstance(Database db, String id)
      Returns a new instance of the collection item with the id
      Type Parameters:
      T - The instance type
      Parameters:
      db - The database
      id - The document id
      Returns:
      The new instance
    • getAssociatedImagePropertyId

      public int getAssociatedImagePropertyId()
      Returns the property id of the associated image for a instance of this collection. If this collection does not have associated images, returns -1. If the instance is itself the associated image, returns -2