@@ -112,24 +112,61 @@ private static FirebaseApp getDefaultFirebaseApp() {
112
112
return app ;
113
113
}
114
114
115
+ /**
116
+ * Returns the existing default {@link FirebaseFirestore} instance that is associated with the
117
+ * default {@link FirebaseApp}. If no instance exists, initializes a new
118
+ * instance with default settings.
119
+ * @param app - The {@link FirebaseApp} instance that the returned {@link FirebaseFirestore}
120
+ * instance is associated with.
121
+ * @param database - The name of database.
122
+ * @returns The {@link FirebaseFirestore} instance of the provided app.
123
+ */
115
124
@ NonNull
116
125
public static FirebaseFirestore getInstance () {
117
126
return getInstance (getDefaultFirebaseApp (), DatabaseId .DEFAULT_DATABASE_ID );
118
127
}
119
128
129
+ /**
130
+ * Returns the existing default {@link FirebaseFirestore} instance that is associated with the
131
+ * provided {@link FirebaseApp}. If no instance exists, initializes a new
132
+ * instance with default settings.
133
+ * @param app - The {@link FirebaseApp} instance that the returned {@link FirebaseFirestore}
134
+ * instance is associated with.
135
+ * @param database - The name of database.
136
+ * @returns The {@link FirebaseFirestore} instance of the provided app.
137
+ */
120
138
@ NonNull
121
139
public static FirebaseFirestore getInstance (@ NonNull FirebaseApp app ) {
122
140
return getInstance (app , DatabaseId .DEFAULT_DATABASE_ID );
123
141
}
124
142
143
+ /**
144
+ * Returns the existing {@link FirebaseFirestore} instance that is associated with the
145
+ * default {@link FirebaseApp}. If no instance exists, initializes a new
146
+ * instance with default settings.
147
+ * @param app - The {@link FirebaseApp} instance that the returned {@link FirebaseFirestore}
148
+ * instance is associated with.
149
+ * @param database - The name of database.
150
+ * @returns The {@link FirebaseFirestore} instance of the provided app.
151
+ */
125
152
@ NonNull
126
153
public static FirebaseFirestore getInstance (@ NonNull String database ) {
127
154
return getInstance (getDefaultFirebaseApp (), database );
128
155
}
129
156
157
+ /**
158
+ * Returns the existing {@link FirebaseFirestore} instance that is associated with the
159
+ * provided {@link FirebaseApp}. If no instance exists, initializes a new
160
+ * instance with default settings.
161
+ * @param app - The {@link FirebaseApp} instance that the returned {@link FirebaseFirestore}
162
+ * instance is associated with.
163
+ * @param database - The name of database.
164
+ * @returns The {@link FirebaseFirestore} instance of the provided app.
165
+ */
130
166
@ NonNull
131
167
public static FirebaseFirestore getInstance (@ NonNull FirebaseApp app , @ NonNull String database ) {
132
168
checkNotNull (app , "Provided FirebaseApp must not be null." );
169
+ checkNotNull (database , "Provided database name must not be null." );
133
170
FirestoreMultiDbComponent component = app .get (FirestoreMultiDbComponent .class );
134
171
checkNotNull (component , "Firestore component is not present." );
135
172
return component .get (database );
0 commit comments