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;
}
}
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: