InMemoryFeatureFlagDataStoreOverride

@ExperimentalCoroutinesApi
class InMemoryFeatureFlagDataStoreOverride(delegate: ObservableFeatureFlagDataStore, initialOverrides: Map<String, Any> = emptyMap()) : ObservableFeatureFlagDataStore

An implementation of ObservableFeatureFlagDataStore that allows overriding values produced by delegate with values held in memory.

Values held in memory within instances of this class will be returned in favor of their counterparts returned from delegate. When a specific key is not overriden in memory, then the underlying value from delegate is returned.

Constructors

Link copied to clipboard
constructor(delegate: ObservableFeatureFlagDataStore, initialOverrides: Map<String, Any> = emptyMap())

Functions

Link copied to clipboard
open override fun getBoolean(key: String, default: Boolean): Boolean

Get the Boolean value associated with key if present. Otherwise, return default.

Link copied to clipboard
open override fun getDouble(key: String, default: Double): Double

Get the Double value associated with key if present. Otherwise, return default.

Link copied to clipboard
open override fun getLong(key: String, default: Long): Long

Get the Long value associated with key if present. Otherwise, return default.

Link copied to clipboard
open override fun getString(key: String, default: String): String

Get the String value associated with key if present. Otherwise, return default.

Link copied to clipboard
open override fun observeBoolean(key: String, default: Boolean): Flow<Boolean>

Return a Flow which emits updates to a Boolean value associated with key if present. When no value is present for key, the returned flow will emit default. The returned flow initially emits the value at the time of collection, and will emit again on each subsequent update for key.

Link copied to clipboard
open override fun observeDouble(key: String, default: Double): Flow<Double>

Return a Flow which emits updates to a Double value associated with key if present. When no value is present for key, the returned flow will emit default. The returned flow initially emits the value at the time of collection, and will emit again on each subsequent update for key.

Link copied to clipboard
open override fun observeLong(key: String, default: Long): Flow<Long>

Return a Flow which emits updates to a Long value associated with key if present. When no value is present for key, the returned flow will emit default. The returned flow initially emits the value at the time of collection, and will emit again on each subsequent update for key.

Link copied to clipboard
open override fun observeString(key: String, default: String): Flow<String>

Return a Flow which emits updates to a String value associated with key if present. When no value is present for key, the returned flow will emit default. The returned flow initially emits the value at the time of collection, and will emit again on each subsequent update for key.

Link copied to clipboard
fun setBoolean(key: String, value: Boolean)
Link copied to clipboard
fun setDouble(key: String, value: Double)
Link copied to clipboard
fun setLong(key: String, value: Long)
Link copied to clipboard
fun setString(key: String, value: String)