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

Add change detection on @Setter #1270

Open
lmonkiewicz opened this issue Dec 23, 2016 · 1 comment
Open

Add change detection on @Setter #1270

lmonkiewicz opened this issue Dec 23, 2016 · 1 comment

Comments

@lmonkiewicz
Copy link

lmonkiewicz commented Dec 23, 2016

It would be really usefull if @Setter could create setters that return true/false when property value was changed or not.

Something like this:

public boolean setValue(String value){
    boolean changed = !Objects.equals(this.value, value);
    if (changed){
        this.value = value;
    }
    return changed;
}
@marcelhaerle
Copy link

I think this is a reasonable suggestion. I would implement this as an optional annotation field, maybe boolean returnHasChanged() default false.

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

2 participants