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

Check data for key existence before using #11

Open
hubertgrzeskowiak opened this issue Jul 18, 2016 · 0 comments
Open

Check data for key existence before using #11

hubertgrzeskowiak opened this issue Jul 18, 2016 · 0 comments

Comments

@hubertgrzeskowiak
Copy link

Before using data.get(foo) we should look up if the key exists in the map and in case it doesn't do nothing in the default setters. I've changed my own Java template to something like this:

/**
* {{#if argument}}{{argument.documentation}}{{else}}{{operation.documentation}}{{/if}}
*
* @return the {{default target.modelName @root.model.name}} class instance.
*/
public {{default target.modelName @root.model.name}} {{operation.name}}() {
{{#if argument}}
{{#unequals type 'radio'}}
    if (data.containsKey("{{argument.key}})")) {
        return {{operation.name}}(data.get("{{argument.key}}"));
    } else {
        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