RxSharedPreferencesMigrationBuilder

public final class RxSharedPreferencesMigrationBuilder<T extends Object>


RxSharedPreferencesMigrationBuilder for the RxSharedPreferencesMigration.

Summary

Public constructors

<T extends Object> RxSharedPreferencesMigrationBuilder(
    Context context,
    String sharedPreferencesName,
    RxSharedPreferencesMigration<T> rxSharedPreferencesMigration
)

Public methods

final @NonNull DataMigration<@NonNull T>

Build and return the DataMigration instance.

final @NonNull RxSharedPreferencesMigrationBuilder<@NonNull T>

Set the list of keys to migrate.

Public constructors

RxSharedPreferencesMigrationBuilder

public final <T extends Object> RxSharedPreferencesMigrationBuilder(
    Context context,
    String sharedPreferencesName,
    RxSharedPreferencesMigration<T> rxSharedPreferencesMigration
)

Public methods

build

public final @NonNull DataMigration<@NonNull T> build()

Build and return the DataMigration instance.

Returns
@NonNull DataMigration<@NonNull T>

the DataMigration.

setKeysToMigrate

public final @NonNull RxSharedPreferencesMigrationBuilder<@NonNull T> setKeysToMigrate(String keys)

Set the list of keys to migrate. The keys will be mapped to datastore.Preferences with their same values. If the key is already present in the new Preferences, the key will not be migrated again. If the key is not present in the SharedPreferences it will not be migrated.

This method is optional and if keysToMigrate is not set, all keys will be migrated from the existing SharedPreferences.

Parameters
String keys

the keys to migrate