Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic preference/key name generation from class/field name #11

Open
yshrsmz opened this issue Apr 13, 2017 · 3 comments
Open

Automatic preference/key name generation from class/field name #11

yshrsmz opened this issue Apr 13, 2017 · 3 comments
Assignees

Comments

@yshrsmz
Copy link
Collaborator

yshrsmz commented Apr 13, 2017

Currently we need to manually define SharedPreferences name and key name, but what if we can generate these name from class/field name?

for example

@Pref
class Sample {  // preference name will be "sample"
    @Key
    long longValue = false;  // key name will be "long_value"
    @Key
    String stringValue = "default_value";  // key name will be "string_value"
}

logic is quite simple, just convert CamelCase to snake_case.
Of course we can still provide custom name with @Key(name = "key_name")

@hotchemi
Copy link
Owner

Interesting, I'm for it!

@yshrsmz
Copy link
Collaborator Author

yshrsmz commented Apr 13, 2017

thanks, will do this asap!
(sorry I didn't notice that #4 is about this)

@hotchemi
Copy link
Owner

NP!
@yshrsmz Ah, actually rxjava2 branch is the latest, so can you reference the branch rather than master?

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

No branches or pull requests

2 participants