Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/swagger-codegen/src/main/resources/Java/pojo.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
{{#isListContainer}}

public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.add({{name}}Item);
return this;
}
{{/isListContainer}}
{{#isMapContainer}}

public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.put(key, {{name}}Item);
return this;
}
Expand Down
10 changes: 10 additions & 0 deletions modules/swagger-codegen/src/main/resources/JavaJaxRS/pojo.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{#isListContainer}}

public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.add({{name}}Item);
return this;
}
{{/isListContainer}}
{{#isMapContainer}}

public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.put(key, {{name}}Item);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{#isListContainer}}

public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.add({{name}}Item);
return this;
}
{{/isListContainer}}
{{#isMapContainer}}

public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.put(key, {{name}}Item);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{#isListContainer}}

public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.add({{name}}Item);
return this;
}
{{/isListContainer}}
{{#isMapContainer}}

public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.put(key, {{name}}Item);
return this;
}
Expand Down
10 changes: 10 additions & 0 deletions modules/swagger-codegen/src/main/resources/MSF4J/pojo.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{#isListContainer}}

public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.add({{name}}Item);
return this;
}
{{/isListContainer}}
{{#isMapContainer}}

public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}
{{/required}}
this.{{name}}.put(key, {{name}}Item);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
}

public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
if (this.mapProperty == null) {
this.mapProperty = new HashMap<String, String>();
}
this.mapProperty.put(key, mapPropertyItem);
return this;
}
Expand All @@ -62,6 +65,9 @@ public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String
}

public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
if (this.mapOfMapProperty == null) {
this.mapOfMapProperty = new HashMap<String, Map<String, String>>();
}
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArr
}

public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (this.arrayArrayNumber == null) {
this.arrayArrayNumber = new ArrayList<List<BigDecimal>>();
}
this.arrayArrayNumber.add(arrayArrayNumberItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
}

public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
if (this.arrayNumber == null) {
this.arrayNumber = new ArrayList<BigDecimal>();
}
this.arrayNumber.add(arrayNumberItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public ArrayTest arrayOfString(List<String> arrayOfString) {
}

public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
if (this.arrayOfString == null) {
this.arrayOfString = new ArrayList<String>();
}
this.arrayOfString.add(arrayOfStringItem);
return this;
}
Expand All @@ -65,6 +68,9 @@ public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
}

public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
if (this.arrayArrayOfInteger == null) {
this.arrayArrayOfInteger = new ArrayList<List<Long>>();
}
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
return this;
}
Expand All @@ -88,6 +94,9 @@ public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel)
}

public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>();
}
this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) {
}

public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) {
if (this.arrayEnum == null) {
this.arrayEnum = new ArrayList<ArrayEnumEnum>();
}
this.arrayEnum.add(arrayEnumItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
}

public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) {
if (this.mapMapOfString == null) {
this.mapMapOfString = new HashMap<String, Map<String, String>>();
}
this.mapMapOfString.put(key, mapMapOfStringItem);
return this;
}
Expand All @@ -92,6 +95,9 @@ public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) {
}

public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) {
if (this.mapOfEnumString == null) {
this.mapOfEnumString = new HashMap<String, InnerEnum>();
}
this.mapOfEnumString.put(key, mapOfEnumStringItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map)
}

public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) {
if (this.map == null) {
this.map = new HashMap<String, Animal>();
}
this.map.put(key, mapItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public Pet tags(List<Tag> tags) {
}

public Pet addTagsItem(Tag tagsItem) {
if (this.tags == null) {
this.tags = new ArrayList<Tag>();
}
this.tags.add(tagsItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
}

public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
if (this.mapProperty == null) {
this.mapProperty = new HashMap<String, String>();
}
this.mapProperty.put(key, mapPropertyItem);
return this;
}
Expand All @@ -62,6 +65,9 @@ public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String
}

public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
if (this.mapOfMapProperty == null) {
this.mapOfMapProperty = new HashMap<String, Map<String, String>>();
}
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArr
}

public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (this.arrayArrayNumber == null) {
this.arrayArrayNumber = new ArrayList<List<BigDecimal>>();
}
this.arrayArrayNumber.add(arrayArrayNumberItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
}

public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
if (this.arrayNumber == null) {
this.arrayNumber = new ArrayList<BigDecimal>();
}
this.arrayNumber.add(arrayNumberItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public ArrayTest arrayOfString(List<String> arrayOfString) {
}

public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
if (this.arrayOfString == null) {
this.arrayOfString = new ArrayList<String>();
}
this.arrayOfString.add(arrayOfStringItem);
return this;
}
Expand All @@ -65,6 +68,9 @@ public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
}

public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
if (this.arrayArrayOfInteger == null) {
this.arrayArrayOfInteger = new ArrayList<List<Long>>();
}
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
return this;
}
Expand All @@ -88,6 +94,9 @@ public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel)
}

public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>();
}
this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) {
}

public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) {
if (this.arrayEnum == null) {
this.arrayEnum = new ArrayList<ArrayEnumEnum>();
}
this.arrayEnum.add(arrayEnumItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
}

public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) {
if (this.mapMapOfString == null) {
this.mapMapOfString = new HashMap<String, Map<String, String>>();
}
this.mapMapOfString.put(key, mapMapOfStringItem);
return this;
}
Expand All @@ -92,6 +95,9 @@ public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) {
}

public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) {
if (this.mapOfEnumString == null) {
this.mapOfEnumString = new HashMap<String, InnerEnum>();
}
this.mapOfEnumString.put(key, mapOfEnumStringItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map)
}

public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) {
if (this.map == null) {
this.map = new HashMap<String, Animal>();
}
this.map.put(key, mapItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public Pet tags(List<Tag> tags) {
}

public Pet addTagsItem(Tag tagsItem) {
if (this.tags == null) {
this.tags = new ArrayList<Tag>();
}
this.tags.add(tagsItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
}

public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
if (this.mapProperty == null) {
this.mapProperty = new HashMap<String, String>();
}
this.mapProperty.put(key, mapPropertyItem);
return this;
}
Expand All @@ -62,6 +65,9 @@ public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String
}

public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
if (this.mapOfMapProperty == null) {
this.mapOfMapProperty = new HashMap<String, Map<String, String>>();
}
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArr
}

public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (this.arrayArrayNumber == null) {
this.arrayArrayNumber = new ArrayList<List<BigDecimal>>();
}
this.arrayArrayNumber.add(arrayArrayNumberItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
}

public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
if (this.arrayNumber == null) {
this.arrayNumber = new ArrayList<BigDecimal>();
}
this.arrayNumber.add(arrayNumberItem);
return this;
}
Expand Down
Loading