EditablePreferences

Subinterface of ReadablePreferences that, in contrast to WritablePreferences, requires an instance of PreferencesEditor to modify preferences.

Parameters

E

editor of this preferences.

Functions

Link copied to clipboard
abstract operator fun contains(key: String): Boolean

Checks whether the preferences contains a preference.

Link copied to clipboard
open fun edit(editAction: E.() -> Unit)

Convenient method to open an editor and apply changes in dsl.

Link copied to clipboard
abstract operator fun get(key: String): String?

Retrieve a String value from the preferences.

Link copied to clipboard
abstract fun getBoolean(key: String): Boolean?

Retrieve a Boolean value from the preferences.

Link copied to clipboard
open fun getBooleanOrDefault(key: String, defaultValue: Boolean): Boolean

Retrieve a Boolean value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getBooleanOrElse(key: String, defaultValue: () -> Boolean): Boolean

Retrieve a Boolean value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getByte(key: String): Byte?

Retrieve a Byte value from the preferences.

Link copied to clipboard
open fun getByteOrDefault(key: String, defaultValue: Byte): Byte

Retrieve a Byte value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getByteOrElse(key: String, defaultValue: () -> Byte): Byte

Retrieve a Byte value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getDouble(key: String): Double?

Retrieve a Double value from the preferences.

Link copied to clipboard
open fun getDoubleOrDefault(key: String, defaultValue: Double): Double

Retrieve a Double value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getDoubleOrElse(key: String, defaultValue: () -> Double): Double

Retrieve a Double value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getFloat(key: String): Float?

Retrieve a Float value from the preferences.

Link copied to clipboard
open fun getFloatOrDefault(key: String, defaultValue: Float): Float

Retrieve a Float value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getFloatOrElse(key: String, defaultValue: () -> Float): Float

Retrieve a Float value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getInt(key: String): Int?

Retrieve an Int value from the preferences.

Link copied to clipboard
open fun getIntOrDefault(key: String, defaultValue: Int): Int

Retrieve an Int value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getIntOrElse(key: String, defaultValue: () -> Int): Int

Retrieve an Int value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getLong(key: String): Long?

Retrieve a Long value from the preferences.

Link copied to clipboard
open fun getLongOrDefault(key: String, defaultValue: Long): Long

Retrieve a Long value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getLongOrElse(key: String, defaultValue: () -> Long): Long

Retrieve a Long value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
open fun getOrDefault(key: String, defaultValue: String?): String?

Retrieve a String value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getOrElse(key: String, defaultValue: () -> String?): String?

Retrieve a String value from the preferences, calling default value getter as a fallback.

Link copied to clipboard
abstract fun getShort(key: String): Short?

Retrieve a Short value from the preferences.

Link copied to clipboard
open fun getShortOrDefault(key: String, defaultValue: Short): Short

Retrieve a Short value from the preferences, providing default value as a fallback.

Link copied to clipboard
open fun getShortOrElse(key: String, defaultValue: () -> Short): Short

Retrieve a Short value from the preferences, calling default value getter as a fallback.

Properties

Link copied to clipboard
abstract val editor: E

Returns an editor to modify preferences.