@Test public void enumNullDefaultValueThrows() { try { rxPreferences.getEnum("key", null, Roshambo.class); fail(); } catch (NullPointerException e) { assertThat(e).hasMessage("defaultValue == null"); } }
@CheckResult @NonNull public <T extends Enum<T>> Preference<T> getEnum(@NonNull String key, @NonNull T defaultValue, @NonNull Class<T> enumClass) { checkNotNull(key, "key == null"); checkNotNull(defaultValue, "defaultValue == null"); checkNotNull(enumClass, "enumClass == null"); return new RealPreference<>(preferences, key, defaultValue, new EnumAdapter<>(enumClass), keyChanges); }
RxSharedPreferences { @CheckResult @NonNull public <T extends Enum<T>> Preference<T> getEnum(@NonNull String key, @NonNull T defaultValue, @NonNull Class<T> enumClass) { checkNotNull(key, "key == null"); checkNotNull(defaultValue, "defaultValue == null"); checkNotNull(enumClass, "enumClass == null"); return new RealPreference<>(preferences, key, defaultValue, new EnumAdapter<>(enumClass), keyChanges); } }
RxSharedPreferences { @CheckResult @NonNull public <T extends Enum<T>> Preference<T> getEnum(@NonNull String key, @NonNull T defaultValue, @NonNull Class<T> enumClass) { checkNotNull(key, "key == null"); checkNotNull(defaultValue, "defaultValue == null"); checkNotNull(enumClass, "enumClass == null"); return new RealPreference<>(preferences, key, defaultValue, new EnumAdapter<>(enumClass), keyChanges); } private  RxSharedPreferences(final SharedPreferences preferences); }
RxSharedPreferences { @CheckResult @NonNull public <T extends Enum<T>> Preference<T> getEnum(@NonNull String key, @NonNull T defaultValue, @NonNull Class<T> enumClass) { checkNotNull(key, "key == null"); checkNotNull(defaultValue, "defaultValue == null"); checkNotNull(enumClass, "enumClass == null"); return new RealPreference<>(preferences, key, defaultValue, new EnumAdapter<>(enumClass), keyChanges); } private  RxSharedPreferences(final SharedPreferences preferences); @CheckResult @NonNull static RxSharedPreferences create(@NonNull SharedPreferences preferences); @CheckResult @NonNull Preference<Boolean> getBoolean(@NonNull String key); @CheckResult @NonNull Preference<Boolean> getBoolean(@NonNull String key, @NonNull Boolean defaultValue); @CheckResult @NonNull Preference<T> getEnum(@NonNull String key, @NonNull T defaultValue,
      @NonNull Class<T> enumClass); @CheckResult @NonNull Preference<Float> getFloat(@NonNull String key); @CheckResult @NonNull Preference<Float> getFloat(@NonNull String key, @NonNull Float defaultValue); @CheckResult @NonNull Preference<Integer> getInteger(@NonNull String key); @CheckResult @NonNull Preference<Integer> getInteger(@NonNull String key, @NonNull Integer defaultValue); @CheckResult @NonNull Preference<Long> getLong(@NonNull String key); @CheckResult @NonNull Preference<Long> getLong(@NonNull String key, @NonNull Long defaultValue); @CheckResult @NonNull Preference<T> getObject(@NonNull String key,
      @NonNull T defaultValue, @NonNull Preference.Converter<T> converter); @CheckResult @NonNull Preference<String> getString(@NonNull String key); @CheckResult @NonNull Preference<String> getString(@NonNull String key, @NonNull String defaultValue); @RequiresApi(HONEYCOMB) @CheckResult @NonNull Preference<Set<String>> getStringSet(@NonNull String key); @RequiresApi(HONEYCOMB) @CheckResult @NonNull Preference<Set<String>> getStringSet(@NonNull String key,
      @NonNull Set<String> defaultValue); void clear(); }
RxSharedPreferences { @CheckResult @NonNull public <T extends Enum<T>> Preference<T> getEnum(@NonNull String key, @NonNull T defaultValue, @NonNull Class<T> enumClass) { checkNotNull(key, "key == null"); checkNotNull(defaultValue, "defaultValue == null"); checkNotNull(enumClass, "enumClass == null"); return new RealPreference<>(preferences, key, defaultValue, new EnumAdapter<>(enumClass), keyChanges); } private  RxSharedPreferences(final SharedPreferences preferences); @CheckResult @NonNull static RxSharedPreferences create(@NonNull SharedPreferences preferences); @CheckResult @NonNull Preference<Boolean> getBoolean(@NonNull String key); @CheckResult @NonNull Preference<Boolean> getBoolean(@NonNull String key, @NonNull Boolean defaultValue); @CheckResult @NonNull Preference<T> getEnum(@NonNull String key, @NonNull T defaultValue,
      @NonNull Class<T> enumClass); @CheckResult @NonNull Preference<Float> getFloat(@NonNull String key); @CheckResult @NonNull Preference<Float> getFloat(@NonNull String key, @NonNull Float defaultValue); @CheckResult @NonNull Preference<Integer> getInteger(@NonNull String key); @CheckResult @NonNull Preference<Integer> getInteger(@NonNull String key, @NonNull Integer defaultValue); @CheckResult @NonNull Preference<Long> getLong(@NonNull String key); @CheckResult @NonNull Preference<Long> getLong(@NonNull String key, @NonNull Long defaultValue); @CheckResult @NonNull Preference<T> getObject(@NonNull String key,
      @NonNull T defaultValue, @NonNull Preference.Converter<T> converter); @CheckResult @NonNull Preference<String> getString(@NonNull String key); @CheckResult @NonNull Preference<String> getString(@NonNull String key, @NonNull String defaultValue); @RequiresApi(HONEYCOMB) @CheckResult @NonNull Preference<Set<String>> getStringSet(@NonNull String key); @RequiresApi(HONEYCOMB) @CheckResult @NonNull Preference<Set<String>> getStringSet(@NonNull String key,
      @NonNull Set<String> defaultValue); void clear();  }