• Stars
    star
    180
  • Rank 208,534 (Top 5 %)
  • Language
    Java
  • License
    Other
  • Created about 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easy SharedPreference Engine foR ANDROid

Maven Central Build Status

esperandro

Easy SharedPreference Engine foR ANDROid

What?

esperandro makes it simple to use SharedPreferences in a nicer and less error-prone way.

Without esperandro a key is referenced by a string:

  • String myPreference = preferences.getString("myPreference", "default value") // load preference
  • preferences.edit().putString("myPreference", myPreference).commit() // store preference

With esperandro you adhere to an interface that you defined:

@SharedPreferences
interface MyPreferences {
    String getMyPreference();
    void setMyPreference(String myPreference);
}
  • String myPreference = preferences.getMyPreference() // load preference
  • preferences.setMyPreference(myPreference) // store preference

Type safe, easy, less error-prone.

Interested? Get Started

Tell me more!

Please refer to the wiki for in-depth examples and all available features.

See the changelog for a brief overview of recent changes.

Gradle artifacts

// essential dependencies
implementation 'de.devland.esperandro:esperandro-api:<insert version>'
annotationProcessor 'de.devland.esperandro:esperandro-preference-gen:<insert version>'

// optional, if object serialization is needed via gson
implementation 'de.devland.esperandro:esperandro-gson-addon:<insert version>'

// optional, if object serialization is needed via jackson
implementation 'de.devland.esperandro:esperandro-jackson-addon:<insert version>'

// additional processor to generate a file with all keys as string constants
annotationProcessor 'de.devland.esperandro:esperandro-keys-gen:<insert version>'

// additional processor to generate a file with all keys as string resources
annotationProcessor 'de.devland.esperandro:esperandro-resources-gen:<insert version>'