Skip to content
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

[java-client] set collection to null when not required #3615

Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -53,6 +53,7 @@ public void arrayArrayNumberTest() {
List<BigDecimal> arrayArrayNumber = new ArrayList<BigDecimal>();
arrayArrayNumber.add(b1);
arrayArrayNumber.add(b2);
model.setArrayArrayNumber(new ArrayList<List<BigDecimal>>());
model.getArrayArrayNumber().add(arrayArrayNumber);

// create another instance for comparison
Expand All @@ -62,6 +63,7 @@ public void arrayArrayNumberTest() {
List<BigDecimal> arrayArrayNumber2 = new ArrayList<BigDecimal>();
arrayArrayNumber2.add(b1);
arrayArrayNumber2.add(b2);
model2.setArrayArrayNumber(new ArrayList<List<BigDecimal>>());
model2.getArrayArrayNumber().add(arrayArrayNumber2);

Assert.assertTrue(model2.equals(model));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}";
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}};
{{/isContainer}}
{{^isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
{{/isContainer}}

{{/vars}}
{{#parcelableModel}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}};
{{/isContainer}}
{{^isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
Expand Down
27 changes: 0 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,33 +281,6 @@
</execution>
</executions>
</plugin>
<plugin>
jmini marked this conversation as resolved.
Show resolved Hide resolved
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<version>2.6</version>
<configuration>
<bundledSignatures>
<!--
This will automatically choose the right
signatures based on 'maven.compiler.target':
-->
<bundledSignature>jdk-unsafe</bundledSignature>
<bundledSignature>jdk-deprecated</bundledSignature>
<bundledSignature>jdk-internal</bundledSignature>
<!-- disallow undocumented classes like sun.misc.Unsafe: -->
<bundledSignature>jdk-non-portable</bundledSignature>
<bundledSignature>jdk-reflection</bundledSignature>
</bundledSignatures>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
<goal>testCheck</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,35 @@
public class AdditionalPropertiesClass {
public static final String JSON_PROPERTY_MAP_STRING = "map_string";
@JsonProperty(JSON_PROPERTY_MAP_STRING)
private Map<String, String> mapString = new HashMap<String, String>();
private Map<String, String> mapString = null;

public static final String JSON_PROPERTY_MAP_NUMBER = "map_number";
@JsonProperty(JSON_PROPERTY_MAP_NUMBER)
private Map<String, BigDecimal> mapNumber = new HashMap<String, BigDecimal>();
private Map<String, BigDecimal> mapNumber = null;

public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer";
@JsonProperty(JSON_PROPERTY_MAP_INTEGER)
private Map<String, Integer> mapInteger = new HashMap<String, Integer>();
private Map<String, Integer> mapInteger = null;

public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean";
@JsonProperty(JSON_PROPERTY_MAP_BOOLEAN)
private Map<String, Boolean> mapBoolean = new HashMap<String, Boolean>();
private Map<String, Boolean> mapBoolean = null;

public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer";
@JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER)
private Map<String, List<Integer>> mapArrayInteger = new HashMap<String, List<Integer>>();
private Map<String, List<Integer>> mapArrayInteger = null;

public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype";
@JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE)
private Map<String, List<Object>> mapArrayAnytype = new HashMap<String, List<Object>>();
private Map<String, List<Object>> mapArrayAnytype = null;

public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string";
@JsonProperty(JSON_PROPERTY_MAP_MAP_STRING)
private Map<String, Map<String, String>> mapMapString = new HashMap<String, Map<String, String>>();
private Map<String, Map<String, String>> mapMapString = null;

public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype";
@JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE)
private Map<String, Map<String, Object>> mapMapAnytype = new HashMap<String, Map<String, Object>>();
private Map<String, Map<String, Object>> mapMapAnytype = null;

public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1";
@JsonProperty(JSON_PROPERTY_ANYTYPE1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class ArrayOfArrayOfNumberOnly {
public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber";
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER)
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<List<BigDecimal>>();
private List<List<BigDecimal>> arrayArrayNumber = null;

public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
this.arrayArrayNumber = arrayArrayNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class ArrayOfNumberOnly {
public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber";
@JsonProperty(JSON_PROPERTY_ARRAY_NUMBER)
private List<BigDecimal> arrayNumber = new ArrayList<BigDecimal>();
private List<BigDecimal> arrayNumber = null;

public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
this.arrayNumber = arrayNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
public class ArrayTest {
public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string";
@JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING)
private List<String> arrayOfString = new ArrayList<String>();
private List<String> arrayOfString = null;

public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer";
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER)
private List<List<Long>> arrayArrayOfInteger = new ArrayList<List<Long>>();
private List<List<Long>> arrayArrayOfInteger = null;

public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>();
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;

public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static ArrayEnumEnum fromValue(String value) {

public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum";
@JsonProperty(JSON_PROPERTY_ARRAY_ENUM)
private List<ArrayEnumEnum> arrayEnum = new ArrayList<ArrayEnumEnum>();
private List<ArrayEnumEnum> arrayEnum = null;

public EnumArrays justSymbol(JustSymbolEnum justSymbol) {
this.justSymbol = justSymbol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class FileSchemaTestClass {

public static final String JSON_PROPERTY_FILES = "files";
@JsonProperty(JSON_PROPERTY_FILES)
private List<java.io.File> files = new ArrayList<java.io.File>();
private List<java.io.File> files = null;

public FileSchemaTestClass file(java.io.File file) {
this.file = file;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class MapTest {
public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string";
@JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING)
private Map<String, Map<String, String>> mapMapOfString = new HashMap<String, Map<String, String>>();
private Map<String, Map<String, String>> mapMapOfString = null;

/**
* Gets or Sets inner
Expand Down Expand Up @@ -70,15 +70,15 @@ public static InnerEnum fromValue(String value) {

public static final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string";
@JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING)
private Map<String, InnerEnum> mapOfEnumString = new HashMap<String, InnerEnum>();
private Map<String, InnerEnum> mapOfEnumString = null;

public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map";
@JsonProperty(JSON_PROPERTY_DIRECT_MAP)
private Map<String, Boolean> directMap = new HashMap<String, Boolean>();
private Map<String, Boolean> directMap = null;

public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map";
@JsonProperty(JSON_PROPERTY_INDIRECT_MAP)
private Map<String, Boolean> indirectMap = new HashMap<String, Boolean>();
private Map<String, Boolean> indirectMap = null;

public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
this.mapMapOfString = mapMapOfString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {

public static final String JSON_PROPERTY_MAP = "map";
@JsonProperty(JSON_PROPERTY_MAP)
private Map<String, Animal> map = new HashMap<String, Animal>();
private Map<String, Animal> map = null;

public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) {
this.uuid = uuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class Pet {

public static final String JSON_PROPERTY_TAGS = "tags";
@JsonProperty(JSON_PROPERTY_TAGS)
private List<Tag> tags = new ArrayList<Tag>();
private List<Tag> tags = null;

/**
* pet status in the store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class XmlItem {

public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array";
@JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY)
private List<Integer> wrappedArray = new ArrayList<Integer>();
private List<Integer> wrappedArray = null;

public static final String JSON_PROPERTY_NAME_STRING = "name_string";
@JsonProperty(JSON_PROPERTY_NAME_STRING)
Expand All @@ -67,11 +67,11 @@ public class XmlItem {

public static final String JSON_PROPERTY_NAME_ARRAY = "name_array";
@JsonProperty(JSON_PROPERTY_NAME_ARRAY)
private List<Integer> nameArray = new ArrayList<Integer>();
private List<Integer> nameArray = null;

public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array";
@JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY)
private List<Integer> nameWrappedArray = new ArrayList<Integer>();
private List<Integer> nameWrappedArray = null;

public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string";
@JsonProperty(JSON_PROPERTY_PREFIX_STRING)
Expand All @@ -91,11 +91,11 @@ public class XmlItem {

public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array";
@JsonProperty(JSON_PROPERTY_PREFIX_ARRAY)
private List<Integer> prefixArray = new ArrayList<Integer>();
private List<Integer> prefixArray = null;

public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array";
@JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY)
private List<Integer> prefixWrappedArray = new ArrayList<Integer>();
private List<Integer> prefixWrappedArray = null;

public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string";
@JsonProperty(JSON_PROPERTY_NAMESPACE_STRING)
Expand All @@ -115,11 +115,11 @@ public class XmlItem {

public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array";
@JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY)
private List<Integer> namespaceArray = new ArrayList<Integer>();
private List<Integer> namespaceArray = null;

public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array";
@JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY)
private List<Integer> namespaceWrappedArray = new ArrayList<Integer>();
private List<Integer> namespaceWrappedArray = null;

public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string";
@JsonProperty(JSON_PROPERTY_PREFIX_NS_STRING)
Expand All @@ -139,11 +139,11 @@ public class XmlItem {

public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array";
@JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY)
private List<Integer> prefixNsArray = new ArrayList<Integer>();
private List<Integer> prefixNsArray = null;

public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array";
@JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY)
private List<Integer> prefixNsWrappedArray = new ArrayList<Integer>();
private List<Integer> prefixNsWrappedArray = null;

public XmlItem attributeString(String attributeString) {
this.attributeString = attributeString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,35 @@
public class AdditionalPropertiesClass {
public static final String JSON_PROPERTY_MAP_STRING = "map_string";
@JsonProperty(JSON_PROPERTY_MAP_STRING)
private Map<String, String> mapString = new HashMap<String, String>();
private Map<String, String> mapString = null;

public static final String JSON_PROPERTY_MAP_NUMBER = "map_number";
@JsonProperty(JSON_PROPERTY_MAP_NUMBER)
private Map<String, BigDecimal> mapNumber = new HashMap<String, BigDecimal>();
private Map<String, BigDecimal> mapNumber = null;

public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer";
@JsonProperty(JSON_PROPERTY_MAP_INTEGER)
private Map<String, Integer> mapInteger = new HashMap<String, Integer>();
private Map<String, Integer> mapInteger = null;

public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean";
@JsonProperty(JSON_PROPERTY_MAP_BOOLEAN)
private Map<String, Boolean> mapBoolean = new HashMap<String, Boolean>();
private Map<String, Boolean> mapBoolean = null;

public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer";
@JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER)
private Map<String, List<Integer>> mapArrayInteger = new HashMap<String, List<Integer>>();
private Map<String, List<Integer>> mapArrayInteger = null;

public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype";
@JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE)
private Map<String, List<Object>> mapArrayAnytype = new HashMap<String, List<Object>>();
private Map<String, List<Object>> mapArrayAnytype = null;

public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string";
@JsonProperty(JSON_PROPERTY_MAP_MAP_STRING)
private Map<String, Map<String, String>> mapMapString = new HashMap<String, Map<String, String>>();
private Map<String, Map<String, String>> mapMapString = null;

public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype";
@JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE)
private Map<String, Map<String, Object>> mapMapAnytype = new HashMap<String, Map<String, Object>>();
private Map<String, Map<String, Object>> mapMapAnytype = null;

public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1";
@JsonProperty(JSON_PROPERTY_ANYTYPE1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class ArrayOfArrayOfNumberOnly {
public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber";
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER)
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<List<BigDecimal>>();
private List<List<BigDecimal>> arrayArrayNumber = null;

public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
this.arrayArrayNumber = arrayArrayNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class ArrayOfNumberOnly {
public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber";
@JsonProperty(JSON_PROPERTY_ARRAY_NUMBER)
private List<BigDecimal> arrayNumber = new ArrayList<BigDecimal>();
private List<BigDecimal> arrayNumber = null;

public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
this.arrayNumber = arrayNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
public class ArrayTest {
public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string";
@JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING)
private List<String> arrayOfString = new ArrayList<String>();
private List<String> arrayOfString = null;

public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer";
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER)
private List<List<Long>> arrayArrayOfInteger = new ArrayList<List<Long>>();
private List<List<Long>> arrayArrayOfInteger = null;

public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>();
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;

public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static ArrayEnumEnum fromValue(String value) {

public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum";
@JsonProperty(JSON_PROPERTY_ARRAY_ENUM)
private List<ArrayEnumEnum> arrayEnum = new ArrayList<ArrayEnumEnum>();
private List<ArrayEnumEnum> arrayEnum = null;

public EnumArrays justSymbol(JustSymbolEnum justSymbol) {
this.justSymbol = justSymbol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class FileSchemaTestClass {

public static final String JSON_PROPERTY_FILES = "files";
@JsonProperty(JSON_PROPERTY_FILES)
private List<java.io.File> files = new ArrayList<java.io.File>();
private List<java.io.File> files = null;

public FileSchemaTestClass file(java.io.File file) {
this.file = file;
Expand Down
Loading