Map Settings
A collection of storage-backed key-value data
This class allows storage of values with the Int, Long, String, Float, Double, or Boolean types, using a String reference as a key.
The CommonMapSettings
implementation is intended for use in unit tests. It differs from production implementations because the state exists only in-memory and has no mechanism for persistence.
This class can be instantiated by wrapping a MutableMap or set of Pair entries.
This implementation is verified against the same test suite as the real platform-specific implementations to ensure it shares the same behavior, assuming the default mutableMapOf delegate is used.
Types
A handle to a listener instance returned by one of the addListener methods of ObservableSettings, so it can be deactivated as needed.
Properties
Functions
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
Adds a listener which will call the supplied callback anytime the value at key changes. A ISettings reference is returned which can be used to halt callbacks by calling ISettings.deactivate. A strong reference should be held to the CommonSettings
returned by this method in order to avoid it being garbage-collected.
In case you need to stop removing expired keys
Get the typed value stored at key if present, or return null if not. Throws IllegalArgumentException if T is not one of Int
, Long
, String
, Float
, Double
, or Boolean
.
Equivalent to Settings.getBoolean
Equivalent to Settings.getDouble
Equivalent to Settings.getFloat
Equivalent to Settings.getInt
Equivalent to Settings.getLong
Equivalent to Settings.getString
Returns the Boolean
value stored at key, or defaultValue if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Boolean
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Boolean
value stored at key, or defaultValue if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns the Boolean
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Double
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Double
value stored at key, or defaultValue if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns the Double
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Float
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Float
value stored at key, or defaultValue if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns the Float
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Int
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Int
value stored at key, or defaultValue if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns the Int
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Long
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow Long
value stored at key, or defaultValue if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns the Long
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow String
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns a Flow String
value stored at key, or defaultValue if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Returns the String
value stored at key, or null
if no value was stored. If a value of a different type was stored at key
, the behavior is not defined.
Equivalent to Settings.remove
Will loop all keys and remove the expired ones
Stores a typed value at key, or remove what's there if value is null. Throws IllegalArgumentException if T is not one of Int
, Long
, String
, Float
, Double
, or Boolean
.
Equivalent to Settings.putBoolean
Equivalent to Settings.putDouble
Equivalent to Settings.putFloat
Equivalent to Settings.putInt
Equivalent to Settings.putLong
Equivalent to Settings.remove
Equivalent to Settings.putString