org.solovyev.android.prefs
Class StringPreference<T>
java.lang.Object
org.solovyev.android.prefs.AbstractPreference<T>
org.solovyev.android.prefs.StringPreference<T>
- Type Parameters:
T -
- All Implemented Interfaces:
- Preference<T>
public final class StringPreference<T>
- extends AbstractPreference<T>
Preference implementation which uses String way of storing object in persistence.
This class provides methods for mapping real java objects to String and vice versa.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringPreference
public StringPreference(@Nonnull
String key,
@Nullable
T defaultValue,
@Nonnull
org.solovyev.common.text.Mapper<T> mapper)
of
@Nonnull
public static StringPreference<String> of(@Nonnull
String key,
@Nullable
String defaultValue)
ofTypedValue
@Nonnull
public static <T> StringPreference<T> ofTypedValue(@Nonnull
String key,
@Nullable
String defaultValue,
@Nonnull
org.solovyev.common.text.Mapper<T> mapper)
ofEnum
@Nonnull
public static <T extends Enum> StringPreference<T> ofEnum(@Nonnull
String key,
@Nullable
T defaultValue,
@Nonnull
Class<T> enumType)
getPersistedValue
protected T getPersistedValue(@Nonnull
android.content.SharedPreferences preferences)
- Specified by:
getPersistedValue in class AbstractPreference<T>
- Parameters:
preferences - preferences container
- Returns:
- preference value from preferences with key defined by
AbstractPreference.getKey() method
putPersistedValue
protected void putPersistedValue(@Nonnull
android.content.SharedPreferences.Editor editor,
@Nonnull
T value)
- Description copied from class:
AbstractPreference
- Method saved preference to preferences container editor
- Specified by:
putPersistedValue in class AbstractPreference<T>
- Parameters:
editor - editor in which value must be savedvalue - value to be saved
Copyright © 2014 se.solovyev. All Rights Reserved.