@@ -72,12 +72,14 @@ public class FirebaseRemoteConfig {
72
72
* @return A singleton instance of {@link FirebaseRemoteConfig} for the default {@link
73
73
* FirebaseApp}.
74
74
*/
75
+ @ NonNull
75
76
public static FirebaseRemoteConfig getInstance () {
76
77
return getInstance (FirebaseApp .getInstance ());
77
78
}
78
79
79
80
/** Returns an instance of Firebase Remote Config for the given {@link FirebaseApp}. */
80
- public static FirebaseRemoteConfig getInstance (FirebaseApp app ) {
81
+ @ NonNull
82
+ public static FirebaseRemoteConfig getInstance (@ NonNull FirebaseApp app ) {
81
83
return app .get (RemoteConfigComponent .class ).getDefault ();
82
84
}
83
85
@@ -178,6 +180,7 @@ public static FirebaseRemoteConfig getInstance(FirebaseApp app) {
178
180
* Returns a {@link Task} representing the initialization status of this Firebase Remote Config
179
181
* instance.
180
182
*/
183
+ @ NonNull
181
184
public Task <FirebaseRemoteConfigInfo > ensureInitialized () {
182
185
Task <ConfigContainer > activatedConfigsTask = activatedConfigsCache .get ();
183
186
Task <ConfigContainer > defaultsConfigsTask = defaultConfigsCache .get ();
@@ -202,6 +205,7 @@ public Task<FirebaseRemoteConfigInfo> ensureInitialized() {
202
205
* configs; if no configs were fetched from the backend and the local fetched configs have
203
206
* already been activated, returns a {@link Task} with a {@code false} result.
204
207
*/
208
+ @ NonNull
205
209
public Task <Boolean > fetchAndActivate () {
206
210
return fetch ().onSuccessTask (executor , (unusedVoid ) -> activate ());
207
211
}
@@ -248,6 +252,7 @@ public boolean activateFetched() {
248
252
* configs; if the fetched configs were already activated by a previous call, returns a {@link
249
253
* Task} with a {@code false} result.
250
254
*/
255
+ @ NonNull
251
256
public Task <Boolean > activate () {
252
257
Task <ConfigContainer > fetchedConfigsTask = fetchedConfigsCache .get ();
253
258
Task <ConfigContainer > activatedConfigsTask = activatedConfigsCache .get ();
@@ -293,6 +298,7 @@ public Task<Boolean> activate() {
293
298
*
294
299
* @return {@link Task} representing the {@code fetch} call.
295
300
*/
301
+ @ NonNull
296
302
public Task <Void > fetch () {
297
303
Task <FetchResponse > fetchTask = fetchHandler .fetch ();
298
304
@@ -317,6 +323,7 @@ public Task<Void> fetch() {
317
323
* this many seconds ago, configs are served from the backend instead of local storage.
318
324
* @return {@link Task} representing the {@code fetch} call.
319
325
*/
326
+ @ NonNull
320
327
public Task <Void > fetch (long minimumFetchIntervalInSeconds ) {
321
328
Task <FetchResponse > fetchTask = fetchHandler .fetch (minimumFetchIntervalInSeconds );
322
329
@@ -339,7 +346,8 @@ public Task<Void> fetch(long minimumFetchIntervalInSeconds) {
339
346
* @return {@link String} representing the value of the Firebase Remote Config parameter with the
340
347
* given key.
341
348
*/
342
- public String getString (String key ) {
349
+ @ NonNull
350
+ public String getString (@ NonNull String key ) {
343
351
return getHandler .getString (key );
344
352
}
345
353
@@ -364,7 +372,7 @@ public String getString(String key) {
364
372
* @return {@code boolean} representing the value of the Firebase Remote Config parameter with the
365
373
* given key.
366
374
*/
367
- public boolean getBoolean (String key ) {
375
+ public boolean getBoolean (@ NonNull String key ) {
368
376
return getHandler .getBoolean (key );
369
377
}
370
378
@@ -383,8 +391,9 @@ public boolean getBoolean(String key) {
383
391
* @return {@code byte[]} representing the value of the Firebase Remote Config parameter with the
384
392
* given key.
385
393
*/
394
+ @ NonNull
386
395
@ Deprecated
387
- public byte [] getByteArray (String key ) {
396
+ public byte [] getByteArray (@ NonNull String key ) {
388
397
return getHandler .getByteArray (key );
389
398
}
390
399
@@ -405,7 +414,7 @@ public byte[] getByteArray(String key) {
405
414
* @return {@code double} representing the value of the Firebase Remote Config parameter with the
406
415
* given key.
407
416
*/
408
- public double getDouble (String key ) {
417
+ public double getDouble (@ NonNull String key ) {
409
418
return getHandler .getDouble (key );
410
419
}
411
420
@@ -426,7 +435,7 @@ public double getDouble(String key) {
426
435
* @return {@code long} representing the value of the Firebase Remote Config parameter with the
427
436
* given key.
428
437
*/
429
- public long getLong (String key ) {
438
+ public long getLong (@ NonNull String key ) {
430
439
return getHandler .getLong (key );
431
440
}
432
441
@@ -445,7 +454,8 @@ public long getLong(String key) {
445
454
* @return {@link FirebaseRemoteConfigValue} representing the value of the Firebase Remote Config
446
455
* parameter with the given key.
447
456
*/
448
- public FirebaseRemoteConfigValue getValue (String key ) {
457
+ @ NonNull
458
+ public FirebaseRemoteConfigValue getValue (@ NonNull String key ) {
449
459
return getHandler .getValue (key );
450
460
}
451
461
@@ -455,7 +465,8 @@ public FirebaseRemoteConfigValue getValue(String key) {
455
465
* @param prefix The key prefix to look for. If the prefix is empty, all keys are returned.
456
466
* @return {@link Set} of Remote Config parameter keys that start with the specified prefix.
457
467
*/
458
- public Set <String > getKeysByPrefix (String prefix ) {
468
+ @ NonNull
469
+ public Set <String > getKeysByPrefix (@ NonNull String prefix ) {
459
470
return getHandler .getKeysByPrefix (prefix );
460
471
}
461
472
@@ -469,6 +480,7 @@ public Set<String> getKeysByPrefix(String prefix) {
469
480
* <li>The default value, if the key was set with {@link #setDefaultsAsync}.
470
481
* </ol>
471
482
*/
483
+ @ NonNull
472
484
public Map <String , FirebaseRemoteConfigValue > getAll () {
473
485
return getHandler .getAll ();
474
486
}
@@ -477,6 +489,7 @@ public Map<String, FirebaseRemoteConfigValue> getAll() {
477
489
* Returns the state of this {@link FirebaseRemoteConfig} instance as a {@link
478
490
* FirebaseRemoteConfigInfo}.
479
491
*/
492
+ @ NonNull
480
493
public FirebaseRemoteConfigInfo getInfo () {
481
494
return frcMetadata .getInfo ();
482
495
}
@@ -488,7 +501,7 @@ public FirebaseRemoteConfigInfo getInfo() {
488
501
* @deprecated Use {@link #setConfigSettingsAsync(FirebaseRemoteConfigSettings)} instead.
489
502
*/
490
503
@ Deprecated
491
- public void setConfigSettings (FirebaseRemoteConfigSettings settings ) {
504
+ public void setConfigSettings (@ NonNull FirebaseRemoteConfigSettings settings ) {
492
505
frcMetadata .setConfigSettingsWithoutWaitingOnDiskWrite (settings );
493
506
}
494
507
@@ -497,7 +510,8 @@ public void setConfigSettings(FirebaseRemoteConfigSettings settings) {
497
510
*
498
511
* @param settings The new settings to be applied.
499
512
*/
500
- public Task <Void > setConfigSettingsAsync (FirebaseRemoteConfigSettings settings ) {
513
+ @ NonNull
514
+ public Task <Void > setConfigSettingsAsync (@ NonNull FirebaseRemoteConfigSettings settings ) {
501
515
return Tasks .call (
502
516
executor ,
503
517
() -> {
@@ -526,7 +540,7 @@ public Task<Void> setConfigSettingsAsync(FirebaseRemoteConfigSettings settings)
526
540
* @deprecated Use {@link #setDefaultsAsync} instead.
527
541
*/
528
542
@ Deprecated
529
- public void setDefaults (Map <String , Object > defaults ) {
543
+ public void setDefaults (@ NonNull Map <String , Object > defaults ) {
530
544
// Fetch values from the server are in the Map<String, String> format, so match that here.
531
545
Map <String , String > defaultsStringMap = new HashMap <>();
532
546
for (Map .Entry <String , Object > defaultsEntry : defaults .entrySet ()) {
@@ -552,7 +566,8 @@ public void setDefaults(Map<String, Object> defaults) {
552
566
* @param defaults {@link Map} of key value pairs representing Firebase Remote Config parameter
553
567
* keys and values.
554
568
*/
555
- public Task <Void > setDefaultsAsync (Map <String , Object > defaults ) {
569
+ @ NonNull
570
+ public Task <Void > setDefaultsAsync (@ NonNull Map <String , Object > defaults ) {
556
571
// Fetch values from the server are in the Map<String, String> format, so match that here.
557
572
Map <String , String > defaultsStringMap = new HashMap <>();
558
573
for (Map .Entry <String , Object > defaultsEntry : defaults .entrySet ()) {
@@ -579,6 +594,7 @@ public void setDefaults(@XmlRes int resourceId) {
579
594
* @param resourceId Id for the XML resource, which should be in your application's {@code
580
595
* res/xml} folder.
581
596
*/
597
+ @ NonNull
582
598
public Task <Void > setDefaultsAsync (@ XmlRes int resourceId ) {
583
599
Map <String , String > xmlDefaults = DefaultsXmlParser .getDefaultsFromXml (context , resourceId );
584
600
return setDefaultsWithStringsMapAsync (xmlDefaults );
@@ -590,6 +606,7 @@ public Task<Void> setDefaultsAsync(@XmlRes int resourceId) {
590
606
*
591
607
* @return {@link Task} representing the {@code clear} call.
592
608
*/
609
+ @ NonNull
593
610
public Task <Void > reset () {
594
611
// Use a Task to avoid throwing potential file I/O errors to the caller and because
595
612
// frcMetadata's clear call is blocking.
0 commit comments