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")
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
logic is quite simple, just convert CamelCase to snake_case. Of course we can still provide custom name with
@Key(name = "key_name")