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
2 changes: 1 addition & 1 deletion bin/java-petstore-jersey1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/jersey1 -DhideGenerationTimestamp=true --library=jersey1"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Java -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/jersey1 -DhideGenerationTimestamp=true --library=jersey1"

echo "Removing files and folders under samples/client/petstore/java/jersey1/src/main"
rm -rf samples/client/petstore/java/jersey1/src/main
Expand Down
14 changes: 14 additions & 0 deletions modules/swagger-codegen/src/main/resources/Java/pojo.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
this.{{name}} = {{name}};
return this;
}
{{#isListContainer}}

public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
this.{{name}}.add({{name}}Item);
return this;
}
{{/isListContainer}}
{{#isMapContainer}}

public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
this.{{name}}.put(key, {{name}}Item);
return this;
}
{{/isMapContainer}}

{{/isReadOnly}}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
return this;
}

public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
this.mapProperty.put(key, mapPropertyItem);
return this;
}

/**
* Get mapProperty
* @return mapProperty
Expand All @@ -68,6 +73,11 @@ public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String
return this;
}

public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
return this;
}

/**
* Get mapOfMapProperty
* @return mapOfMapProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArr
return this;
}

public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
this.arrayArrayNumber.add(arrayArrayNumberItem);
return this;
}

/**
* Get arrayArrayNumber
* @return arrayArrayNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
return this;
}

public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
this.arrayNumber.add(arrayNumberItem);
return this;
}

/**
* Get arrayNumber
* @return arrayNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public ArrayTest arrayOfString(List<String> arrayOfString) {
return this;
}

public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
this.arrayOfString.add(arrayOfStringItem);
return this;
}

/**
* Get arrayOfString
* @return arrayOfString
Expand All @@ -71,6 +76,11 @@ public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
return this;
}

public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
return this;
}

/**
* Get arrayArrayOfInteger
* @return arrayArrayOfInteger
Expand All @@ -89,6 +99,11 @@ public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel)
return this;
}

public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this;
}

/**
* Get arrayArrayOfModel
* @return arrayArrayOfModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
return this;
}

public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) {
this.mapMapOfString.put(key, mapMapOfStringItem);
return this;
}

/**
* Get mapMapOfString
* @return mapMapOfString
Expand All @@ -88,6 +93,11 @@ public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) {
return this;
}

public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) {
this.mapOfEnumString.put(key, mapOfEnumStringItem);
return this;
}

/**
* Get mapOfEnumString
* @return mapOfEnumString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map)
return this;
}

public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) {
this.map.put(key, mapItem);
return this;
}

/**
* Get map
* @return map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ public Pet photoUrls(List<String> photoUrls) {
return this;
}

public Pet addPhotoUrlsItem(String photoUrlsItem) {
this.photoUrls.add(photoUrlsItem);
return this;
}

/**
* Get photoUrls
* @return photoUrls
Expand All @@ -157,6 +162,11 @@ public Pet tags(List<Tag> tags) {
return this;
}

public Pet addTagsItem(Tag tagsItem) {
this.tags.add(tagsItem);
return this;
}

/**
* Get tags
* @return tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
return this;
}

public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
this.mapProperty.put(key, mapPropertyItem);
return this;
}

/**
* Get mapProperty
* @return mapProperty
Expand All @@ -68,6 +73,11 @@ public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String
return this;
}

public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
return this;
}

/**
* Get mapOfMapProperty
* @return mapOfMapProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArr
return this;
}

public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
this.arrayArrayNumber.add(arrayArrayNumberItem);
return this;
}

/**
* Get arrayArrayNumber
* @return arrayArrayNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
return this;
}

public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
this.arrayNumber.add(arrayNumberItem);
return this;
}

/**
* Get arrayNumber
* @return arrayNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public ArrayTest arrayOfString(List<String> arrayOfString) {
return this;
}

public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
this.arrayOfString.add(arrayOfStringItem);
return this;
}

/**
* Get arrayOfString
* @return arrayOfString
Expand All @@ -71,6 +76,11 @@ public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
return this;
}

public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
return this;
}

/**
* Get arrayArrayOfInteger
* @return arrayArrayOfInteger
Expand All @@ -89,6 +99,11 @@ public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel)
return this;
}

public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this;
}

/**
* Get arrayArrayOfModel
* @return arrayArrayOfModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
return this;
}

public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) {
this.mapMapOfString.put(key, mapMapOfStringItem);
return this;
}

/**
* Get mapMapOfString
* @return mapMapOfString
Expand All @@ -88,6 +93,11 @@ public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) {
return this;
}

public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) {
this.mapOfEnumString.put(key, mapOfEnumStringItem);
return this;
}

/**
* Get mapOfEnumString
* @return mapOfEnumString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map)
return this;
}

public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) {
this.map.put(key, mapItem);
return this;
}

/**
* Get map
* @return map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ public Pet photoUrls(List<String> photoUrls) {
return this;
}

public Pet addPhotoUrlsItem(String photoUrlsItem) {
this.photoUrls.add(photoUrlsItem);
return this;
}

/**
* Get photoUrls
* @return photoUrls
Expand All @@ -157,6 +162,11 @@ public Pet tags(List<Tag> tags) {
return this;
}

public Pet addTagsItem(Tag tagsItem) {
this.tags.add(tagsItem);
return this;
}

/**
* Get tags
* @return tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
return this;
}

public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
this.mapProperty.put(key, mapPropertyItem);
return this;
}

/**
* Get mapProperty
* @return mapProperty
Expand All @@ -68,6 +73,11 @@ public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String
return this;
}

public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
return this;
}

/**
* Get mapOfMapProperty
* @return mapOfMapProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArr
return this;
}

public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
this.arrayArrayNumber.add(arrayArrayNumberItem);
return this;
}

/**
* Get arrayArrayNumber
* @return arrayArrayNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
return this;
}

public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
this.arrayNumber.add(arrayNumberItem);
return this;
}

/**
* Get arrayNumber
* @return arrayNumber
Expand Down
Loading