-
- All Implemented Interfaces:
public final class AsPropertyKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> ReadWriteProperty<Object, T>asProperty(Preferences $self, KSerializer<T> serializer, String tag)Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them. final static <T extends Any> ReadWriteProperty<Object, T>asProperty(Preferences $self, KSerializer<T> serializer, String tag, T default)Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them. final static <T extends Any> ReadWriteProperty<Object, T>asProperty(Preferences $self, String tag)Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them. final static <T extends Any> ReadWriteProperty<Object, T>asProperty(Preferences $self, String tag, T default)Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them. -
-
Method Detail
-
asProperty
final static <T extends Any> ReadWriteProperty<Object, T> asProperty(Preferences $self, KSerializer<T> serializer, String tag)
Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.
var setting by preferences.asProperty(Boolean.serializer())- Parameters:
serializer- which encodes and decodes the valuetag- optional tag which is used as SharedPreferences key - default to property name
-
asProperty
final static <T extends Any> ReadWriteProperty<Object, T> asProperty(Preferences $self, KSerializer<T> serializer, String tag, T default)
Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.
var setting by preferences.asProperty(Boolean.serializer(), tag = "aSetting", default = false)- Parameters:
serializer- which encodes and decodes the valuetag- optional tag which is used as SharedPreferences key - default to property namedefault- optional default value for not initialized preferences
-
asProperty
final static <T extends Any> ReadWriteProperty<Object, T> asProperty(Preferences $self, String tag)
Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.
var setting: Boolean by preferences.asProperty()- Parameters:
tag- optional tag which is used as SharedPreferences key - default to property name
-
asProperty
final static <T extends Any> ReadWriteProperty<Object, T> asProperty(Preferences $self, String tag, T default)
Encodes changes to the delegated property into the SharedPreferences and decodes the current value from them.
var setting: Boolean by preferences.asProperty(tag = "aSetting", default = false)- Parameters:
tag- optional tag which is used as SharedPreferences key - default to property namedefault- optional default value for not initialized preferences
-
-
-
-