Add nullable array support in spring (#2660)

* Add nullable support in spring

* fix forgot unescape defaultValue

* Fix syntax error
This commit is contained in:
tanmen 2019-04-18 12:05:18 +09:00 committed by William Cheng
parent e17890d526
commit ff0d4eb8d7

View File

@ -44,11 +44,11 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}
public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}} {{^required}}
if (this.{{name}} == null) { if (this.{{name}} == null{{#isNullable}} || !this.{{name}}.isPresent(){{/isNullable}}) {
this.{{name}} = {{{defaultValue}}}; this.{{name}} = {{#isNullable}}JsonNullable.of({{{defaultValue}}}){{/isNullable}}{{^isNullable}}{{{defaultValue}}}{{/isNullable}};
} }
{{/required}} {{/required}}
this.{{name}}.add({{name}}Item); this.{{name}}{{#isNullable}}.get(){{/isNullable}}.add({{name}}Item);
return this; return this;
} }
{{/isListContainer}} {{/isListContainer}}