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

[feature] Support custom annotations #12

Open
wrozwad opened this issue Sep 13, 2016 · 0 comments
Open

[feature] Support custom annotations #12

wrozwad opened this issue Sep 13, 2016 · 0 comments

Comments

@wrozwad
Copy link
Contributor

wrozwad commented Sep 13, 2016

It'll be nice to support field annotations like IntDef annotations.

Eg. I want that this field

@Navigation.NavSection
@DefaultInt(Navigatory.DEFAULT_NAV_SECTION) //DEFAULT_NAV_SECTION == 666
Integer currentNavItem;

will generate

@Navigation.NavSection
public Integer getCurrentNavItem() {
    if (!contains("currentNavItem")) return 666; //btw - is this line necessary?
    return getInt("currentNavItem", 666);
}

public boolean containsCurrentNavItem() {
    return contains("currentNavItem");
}

public SharedPrefs putCurrentNavItem(@Navigation.NavSection Integer currentNavItem) {
    edit().putCurrentNavItem(currentNavItem).apply();
    return this;
}

public SharedPrefs removeCurrentNavItem() {
    edit().remove("currentNavItem").apply();
    return this;
}
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

No branches or pull requests

1 participant