Class DatabaseConnection
- java.lang.Object
-
- com.cmput301w23t09.qrhunter.database.DatabaseConnection
-
public class DatabaseConnection extends java.lang.Object
Wrapper class to wrap around retrieving Firebase data
-
-
Constructor Summary
Constructors Constructor Description DatabaseConnection()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.firebase.firestore.CollectionReference
getCollection(java.lang.String name)
Retrieve a firebase collection prefixed by the collection prefixjava.lang.String
getCollectionPrefix()
All collections have a prefix describing their current environment.static DatabaseConnection
getInstance()
Retrieve the instance of the DatabaseConnectionstatic void
mockInstance(DatabaseConnection connection)
Update the instance of the database connection
-
-
-
Method Detail
-
getCollectionPrefix
public java.lang.String getCollectionPrefix()
All collections have a prefix describing their current environment.- Returns:
- collection prefix
-
getCollection
public com.google.firebase.firestore.CollectionReference getCollection(java.lang.String name)
Retrieve a firebase collection prefixed by the collection prefix- Parameters:
name
- name of the collection- Returns:
- collection
-
getInstance
public static DatabaseConnection getInstance()
Retrieve the instance of the DatabaseConnection- Returns:
- database connection
-
mockInstance
public static void mockInstance(DatabaseConnection connection)
Update the instance of the database connection- Parameters:
connection
- database connection
-
-