Skip to content

[JAVA][jaxrs-spec] Added custom methods to add/remove elements from java collections #6468

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

Merged
merged 1 commit into from
Mar 27, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,45 @@ import com.fasterxml.jackson.annotation.JsonValue;

public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
this.{{name}} = {{name}};
}{{/vars}}
}

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

this.{{name}}.add({{name}}Item);
return this;
}

public {{classname}} remove{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
if ({{name}}Item != null && this.{{name}} != null) {
this.{{name}}.remove({{name}}Item);
}

return this;
}
{{/isListContainer}}
{{#isMapContainer}}
public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}};
}

this.{{name}}.put(key, {{name}}Item);
return this;
}

public {{classname}} remove{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
if ({{name}}Item != null && this.{{name}} != null) {
this.{{name}}.remove({{name}}Item);
}

return this;
}
{{/isMapContainer}}
{{/vars}}

@Override
public boolean equals(java.lang.Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void setName(String name) {
this.name = name;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void setName(String name) {
this.name = name;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void setName(String name) {
this.name = name;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,25 @@ public Map<String, String> getMapString() {

public void setMapString(Map<String, String> mapString) {
this.mapString = mapString;
}/**
}

public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) {
if (this.mapString == null) {
this.mapString = new HashMap<String, String>();
}

this.mapString.put(key, mapStringItem);
return this;
}

public AdditionalPropertiesClass removeMapStringItem(String mapStringItem) {
if (mapStringItem != null && this.mapString != null) {
this.mapString.remove(mapStringItem);
}

return this;
}
/**
**/
public AdditionalPropertiesClass mapNumber(Map<String, BigDecimal> mapNumber) {
this.mapNumber = mapNumber;
Expand All @@ -68,7 +86,25 @@ public Map<String, BigDecimal> getMapNumber() {

public void setMapNumber(Map<String, BigDecimal> mapNumber) {
this.mapNumber = mapNumber;
}/**
}

public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) {
if (this.mapNumber == null) {
this.mapNumber = new HashMap<String, BigDecimal>();
}

this.mapNumber.put(key, mapNumberItem);
return this;
}

public AdditionalPropertiesClass removeMapNumberItem(BigDecimal mapNumberItem) {
if (mapNumberItem != null && this.mapNumber != null) {
this.mapNumber.remove(mapNumberItem);
}

return this;
}
/**
**/
public AdditionalPropertiesClass mapInteger(Map<String, Integer> mapInteger) {
this.mapInteger = mapInteger;
Expand All @@ -86,7 +122,25 @@ public Map<String, Integer> getMapInteger() {

public void setMapInteger(Map<String, Integer> mapInteger) {
this.mapInteger = mapInteger;
}/**
}

public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) {
if (this.mapInteger == null) {
this.mapInteger = new HashMap<String, Integer>();
}

this.mapInteger.put(key, mapIntegerItem);
return this;
}

public AdditionalPropertiesClass removeMapIntegerItem(Integer mapIntegerItem) {
if (mapIntegerItem != null && this.mapInteger != null) {
this.mapInteger.remove(mapIntegerItem);
}

return this;
}
/**
**/
public AdditionalPropertiesClass mapBoolean(Map<String, Boolean> mapBoolean) {
this.mapBoolean = mapBoolean;
Expand All @@ -104,7 +158,25 @@ public Map<String, Boolean> getMapBoolean() {

public void setMapBoolean(Map<String, Boolean> mapBoolean) {
this.mapBoolean = mapBoolean;
}/**
}

public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) {
if (this.mapBoolean == null) {
this.mapBoolean = new HashMap<String, Boolean>();
}

this.mapBoolean.put(key, mapBooleanItem);
return this;
}

public AdditionalPropertiesClass removeMapBooleanItem(Boolean mapBooleanItem) {
if (mapBooleanItem != null && this.mapBoolean != null) {
this.mapBoolean.remove(mapBooleanItem);
}

return this;
}
/**
**/
public AdditionalPropertiesClass mapArrayInteger(Map<String, List<Integer>> mapArrayInteger) {
this.mapArrayInteger = mapArrayInteger;
Expand All @@ -122,7 +194,25 @@ public Map<String, List<Integer>> getMapArrayInteger() {

public void setMapArrayInteger(Map<String, List<Integer>> mapArrayInteger) {
this.mapArrayInteger = mapArrayInteger;
}/**
}

public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) {
if (this.mapArrayInteger == null) {
this.mapArrayInteger = new HashMap<String, List<Integer>>();
}

this.mapArrayInteger.put(key, mapArrayIntegerItem);
return this;
}

public AdditionalPropertiesClass removeMapArrayIntegerItem(List<Integer> mapArrayIntegerItem) {
if (mapArrayIntegerItem != null && this.mapArrayInteger != null) {
this.mapArrayInteger.remove(mapArrayIntegerItem);
}

return this;
}
/**
**/
public AdditionalPropertiesClass mapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) {
this.mapArrayAnytype = mapArrayAnytype;
Expand All @@ -140,7 +230,25 @@ public Map<String, List<Object>> getMapArrayAnytype() {

public void setMapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) {
this.mapArrayAnytype = mapArrayAnytype;
}/**
}

public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) {
if (this.mapArrayAnytype == null) {
this.mapArrayAnytype = new HashMap<String, List<Object>>();
}

this.mapArrayAnytype.put(key, mapArrayAnytypeItem);
return this;
}

public AdditionalPropertiesClass removeMapArrayAnytypeItem(List<Object> mapArrayAnytypeItem) {
if (mapArrayAnytypeItem != null && this.mapArrayAnytype != null) {
this.mapArrayAnytype.remove(mapArrayAnytypeItem);
}

return this;
}
/**
**/
public AdditionalPropertiesClass mapMapString(Map<String, Map<String, String>> mapMapString) {
this.mapMapString = mapMapString;
Expand All @@ -158,7 +266,25 @@ public Map<String, Map<String, String>> getMapMapString() {

public void setMapMapString(Map<String, Map<String, String>> mapMapString) {
this.mapMapString = mapMapString;
}/**
}

public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) {
if (this.mapMapString == null) {
this.mapMapString = new HashMap<String, Map<String, String>>();
}

this.mapMapString.put(key, mapMapStringItem);
return this;
}

public AdditionalPropertiesClass removeMapMapStringItem(Map<String, String> mapMapStringItem) {
if (mapMapStringItem != null && this.mapMapString != null) {
this.mapMapString.remove(mapMapStringItem);
}

return this;
}
/**
**/
public AdditionalPropertiesClass mapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) {
this.mapMapAnytype = mapMapAnytype;
Expand All @@ -176,7 +302,25 @@ public Map<String, Map<String, Object>> getMapMapAnytype() {

public void setMapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) {
this.mapMapAnytype = mapMapAnytype;
}/**
}

public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) {
if (this.mapMapAnytype == null) {
this.mapMapAnytype = new HashMap<String, Map<String, Object>>();
}

this.mapMapAnytype.put(key, mapMapAnytypeItem);
return this;
}

public AdditionalPropertiesClass removeMapMapAnytypeItem(Map<String, Object> mapMapAnytypeItem) {
if (mapMapAnytypeItem != null && this.mapMapAnytype != null) {
this.mapMapAnytype.remove(mapMapAnytypeItem);
}

return this;
}
/**
**/
public AdditionalPropertiesClass anytype1(Object anytype1) {
this.anytype1 = anytype1;
Expand All @@ -194,7 +338,9 @@ public Object getAnytype1() {

public void setAnytype1(Object anytype1) {
this.anytype1 = anytype1;
}/**
}

/**
**/
public AdditionalPropertiesClass anytype2(Object anytype2) {
this.anytype2 = anytype2;
Expand All @@ -212,7 +358,9 @@ public Object getAnytype2() {

public void setAnytype2(Object anytype2) {
this.anytype2 = anytype2;
}/**
}

/**
**/
public AdditionalPropertiesClass anytype3(Object anytype3) {
this.anytype3 = anytype3;
Expand All @@ -232,6 +380,7 @@ public void setAnytype3(Object anytype3) {
this.anytype3 = anytype3;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void setName(String name) {
this.name = name;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void setName(String name) {
this.name = name;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void setName(String name) {
this.name = name;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void setName(String name) {
this.name = name;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public String getClassName() {

public void setClassName(String className) {
this.className = className;
}/**
}

/**
**/
public Animal color(String color) {
this.color = color;
Expand All @@ -66,6 +68,7 @@ public void setColor(String color) {
this.color = color;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ public void setArrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
this.arrayArrayNumber = arrayArrayNumber;
}

public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (this.arrayArrayNumber == null) {
this.arrayArrayNumber = new ArrayList<List<BigDecimal>>();
}

this.arrayArrayNumber.add(arrayArrayNumberItem);
return this;
}

public ArrayOfArrayOfNumberOnly removeArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (arrayArrayNumberItem != null && this.arrayArrayNumber != null) {
this.arrayArrayNumber.remove(arrayArrayNumberItem);
}

return this;
}

@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
Expand Down
Loading