Skip to content

Default SharedPreferences key#8

Open
DanielGrech wants to merge 2 commits intofdoyle:masterfrom
DanielGrech:feature/default_preference_key
Open

Default SharedPreferences key#8
DanielGrech wants to merge 2 commits intofdoyle:masterfrom
DanielGrech:feature/default_preference_key

Conversation

@DanielGrech
Copy link

Often i'm not too concerned with the actual key that gets stored into shared preferences. Given the declarative nature of this library, it can seem superfluous to set a string for the underlying SharedPreferences.

This PR removes the need to add a @Preference annotation to each item in the datastore interface. If no preference is supplied, the name of the method is used as the key. Otherwise the preference value is used as always.

As a side-affect, this PR also fixes a NullPointerException if a method is not annotated.

README and sample app also updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant