@Test public void testGetFromPreferences() { final SharedPreference<String> preference = new PreferenceImpl(PREF_KEY, PREF_DEF_VALUE); assertThat(preference.getFromPreferences(preferences), is(PREF_DEF_VALUE)); assertThat(preference.getValue(), is(PREF_DEF_VALUE)); assertThat(preference.getFromPreferences(preferences), is(PREF_DEF_VALUE)); assertThat(preference.getValue(), is(PREF_DEF_VALUE)); }
@Nullable final T getFromPreferences(final SharedPreferences preferences) { if (!valueIsActual) { this.value = onGetFromPreferences(preferences); this.valueIsActual = true; } return value; }
SharedPreference { @Nullable final T getFromPreferences(final SharedPreferences preferences) { if (!valueIsActual) { this.value = onGetFromPreferences(preferences); this.valueIsActual = true; } return value; } }
SharedPreference { @Nullable final T getFromPreferences(final SharedPreferences preferences) { if (!valueIsActual) { this.value = onGetFromPreferences(preferences); this.valueIsActual = true; } return value; } protected  SharedPreference(@NonNull final String key, @Nullable final T defValue); }
SharedPreference { @Nullable final T getFromPreferences(final SharedPreferences preferences) { if (!valueIsActual) { this.value = onGetFromPreferences(preferences); this.valueIsActual = true; } return value; } protected  SharedPreference(@NonNull final String key, @Nullable final T defValue); @NonNull final String getKey(); @NonNull SharedPreferences.OnSharedPreferenceChangeListener createOnChangeListener(@NonNull final PreferenceChangeCallback<T> callback); @Nullable final T getDefaultValue(); SharedPreference<T> updateValue(@Nullable final T newValue); final boolean putIntoPreferences(@NonNull final SharedPreferences preferences); @Nullable final T getValue(); }
SharedPreference { @Nullable final T getFromPreferences(final SharedPreferences preferences) { if (!valueIsActual) { this.value = onGetFromPreferences(preferences); this.valueIsActual = true; } return value; } protected  SharedPreference(@NonNull final String key, @Nullable final T defValue); @NonNull final String getKey(); @NonNull SharedPreferences.OnSharedPreferenceChangeListener createOnChangeListener(@NonNull final PreferenceChangeCallback<T> callback); @Nullable final T getDefaultValue(); SharedPreference<T> updateValue(@Nullable final T newValue); final boolean putIntoPreferences(@NonNull final SharedPreferences preferences); @Nullable final T getValue();  }