@Serializable
public class StateStoreKey<T extends Object>


Open class that should be extended to define specific key-value types to be stored in the StateStore to ensure it is type safe.

The class T should be the value of the type that that should be retrieved and should also be @Serializable along with the extending class.

Summary

Public constructors

<T extends Object> StateStoreKey(
    @NonNull T defaultValue,
    StateStoreKey<@NonNull ?> autoClearKey,
    @NonNull Function1<@NonNull StateStore, @NonNull Boolean> shouldClearState
)

Public methods

final StateStoreKey<@NonNull ?>

set this if you would like the state associated with this key to be automatically cleared from the StateStore when shouldClearState is true.

final @NonNull T

an instance of the type T that is associated with this key by default.

final @NonNull Function1<@NonNull StateStore, @NonNull Boolean>

the condition to determine whether the state should be cleared or not.

Public constructors

StateStoreKey

public <T extends Object> StateStoreKey(
    @NonNull T defaultValue,
    StateStoreKey<@NonNull ?> autoClearKey,
    @NonNull Function1<@NonNull StateStore, @NonNull Boolean> shouldClearState
)
Parameters
@NonNull T defaultValue

an instance of the type T that is associated with this key by default.

StateStoreKey<@NonNull ?> autoClearKey

set this if you would like the state associated with this key to be automatically cleared from the StateStore when shouldClearState is true.

@NonNull Function1<@NonNull StateStore, @NonNull Boolean> shouldClearState

the condition to determine whether the state should be cleared or not.

Public methods

getAutoClearKey

Added in 1.0.0-alpha01
public final StateStoreKey<@NonNull ?> getAutoClearKey()

set this if you would like the state associated with this key to be automatically cleared from the StateStore when shouldClearState is true.

getDefaultValue

Added in 1.0.0-alpha01
public final @NonNull T getDefaultValue()

an instance of the type T that is associated with this key by default.

getShouldClearState

Added in 1.0.0-alpha01
public final @NonNull Function1<@NonNull StateStore, @NonNull Boolean> getShouldClearState()

the condition to determine whether the state should be cleared or not.