RxSharedPreferencesMigrationBuilder


public final class RxSharedPreferencesMigrationBuilder<T extends Object>


RxSharedPreferencesMigrationBuilder for the RxSharedPreferencesMigration.

Summary

Public constructors

<T extends Object> RxSharedPreferencesMigrationBuilder(
    @NonNull Context context,
    @NonNull String sharedPreferencesName,
    @NonNull RxSharedPreferencesMigration<@NonNull 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 <T extends Object> RxSharedPreferencesMigrationBuilder(
    @NonNull Context context,
    @NonNull String sharedPreferencesName,
    @NonNull RxSharedPreferencesMigration<@NonNull T> rxSharedPreferencesMigration
)

Public methods

build

Added in 1.0.0
public final @NonNull DataMigration<@NonNull T> build()

Build and return the DataMigration instance.

Returns
@NonNull DataMigration<@NonNull T>

the DataMigration.

setKeysToMigrate

Added in 1.0.0
public final @NonNull RxSharedPreferencesMigrationBuilder<@NonNull T> setKeysToMigrate(@NonNull 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
@NonNull String keys

the keys to migrate