//Android/br.com.arch.toolkit.android.storage.delegate/OptionalStorageDelegate
data class OptionalStorageDelegate<T : Any> : StorageDelegate<T>
A property delegate for optional values in KeyValueStorage.
It supports primitive types, Enums, and complex objects (via br.com.arch.toolkit.android.storage.ComplexDataParser). It also includes a memory cache with a ThresholdData mechanism.
android
| Â | Â |
|---|---|
| T | The type of data to store. |
| Name | Summary |
|---|---|
| getValue | [android] operator fun getValue(thisRef: Any?, property: KProperty<*>): T? |
| required | [android] fun required(default: T): NonOptionalStorageDelegate<T> Makes this delegate non-optional by providing a default value. [android] fun required(default: () -> T): NonOptionalStorageDelegate<T> Makes this delegate non-optional by providing a default value provider. |
| setValue | [android] operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T?) |
| storage | [android] fun storage(storage: KeyValueStorage): OptionalStorageDelegate<T> Configures the KeyValueStorage for this delegate. [android] fun storage(storage: () -> KeyValueStorage): OptionalStorageDelegate<T> Configures the KeyValueStorage provider for this delegate. |
| threshold | [android] fun threshold(threshold: Duration): OptionalStorageDelegate<T> Configures the expiration threshold for the memory cache. |