Add constructor with required parameter for Spring (#14822) (fix #9789)

* Add constructor with required parameter for spring

Fix #9789

* [Java][Spring] constructor with required args

---------

Co-authored-by: Oleh Kurpiak <oleh.kurpiak@gmail.com>
This commit is contained in:
Antoine Lucas
2023-03-01 14:09:47 +01:00
committed by GitHub
parent c70a41210e
commit e1ab25c915
328 changed files with 4790 additions and 7562 deletions

View File

@@ -44,6 +44,22 @@ public class Animal {
@JsonProperty("color")
private String color = "red";
/**
* Default constructor
* @deprecated Use {@link Animal#Animal(String)}
*/
@Deprecated
public Animal() {
super();
}
/**
* Constructor with only required parameters
*/
public Animal(String className) {
this.className = className;
}
public Animal className(String className) {
this.className = className;
return this;

View File

@@ -69,6 +69,22 @@ public class BigCat extends Cat {
@JsonProperty("kind")
private KindEnum kind;
/**
* Default constructor
* @deprecated Use {@link BigCat#BigCat(String)}
*/
@Deprecated
public BigCat() {
super();
}
/**
* Constructor with only required parameters
*/
public BigCat(String className) {
super(className);
}
public BigCat kind(KindEnum kind) {
this.kind = kind;
return this;

View File

@@ -38,6 +38,22 @@ public class Cat extends Animal {
@JsonProperty("declawed")
private Boolean declawed;
/**
* Default constructor
* @deprecated Use {@link Cat#Cat(String)}
*/
@Deprecated
public Cat() {
super();
}
/**
* Constructor with only required parameters
*/
public Cat(String className) {
super(className);
}
public Cat declawed(Boolean declawed) {
this.declawed = declawed;
return this;

View File

@@ -27,6 +27,22 @@ public class Category {
@JsonProperty("name")
private String name = "default-name";
/**
* Default constructor
* @deprecated Use {@link Category#Category(String)}
*/
@Deprecated
public Category() {
super();
}
/**
* Constructor with only required parameters
*/
public Category(String name) {
this.name = name;
}
public Category id(Long id) {
this.id = id;
return this;

View File

@@ -29,6 +29,22 @@ public class Dog extends Animal {
@JsonProperty("breed")
private String breed;
/**
* Default constructor
* @deprecated Use {@link Dog#Dog(String)}
*/
@Deprecated
public Dog() {
super();
}
/**
* Constructor with only required parameters
*/
public Dog(String className) {
super(className);
}
public Dog breed(String breed) {
this.breed = breed;
return this;

View File

@@ -184,6 +184,22 @@ public class EnumTest {
@JsonProperty("outerEnum")
private OuterEnum outerEnum;
/**
* Default constructor
* @deprecated Use {@link EnumTest#EnumTest(EnumStringRequiredEnum)}
*/
@Deprecated
public EnumTest() {
super();
}
/**
* Constructor with only required parameters
*/
public EnumTest(EnumStringRequiredEnum enumStringRequired) {
this.enumStringRequired = enumStringRequired;
}
public EnumTest enumString(EnumStringEnum enumString) {
this.enumString = enumString;
return this;

View File

@@ -73,6 +73,25 @@ public class FormatTest {
@JsonProperty("BigDecimal")
private BigDecimal bigDecimal;
/**
* Default constructor
* @deprecated Use {@link FormatTest#FormatTest(BigDecimal, byte[], LocalDate, String)}
*/
@Deprecated
public FormatTest() {
super();
}
/**
* Constructor with only required parameters
*/
public FormatTest(BigDecimal number, byte[] _byte, LocalDate date, String password) {
this.number = number;
this._byte = _byte;
this.date = date;
this.password = password;
}
public FormatTest integer(Integer integer) {
this.integer = integer;
return this;

View File

@@ -34,6 +34,22 @@ public class Name {
@JsonProperty("123Number")
private Integer _123number;
/**
* Default constructor
* @deprecated Use {@link Name#Name(Integer)}
*/
@Deprecated
public Name() {
super();
}
/**
* Constructor with only required parameters
*/
public Name(Integer name) {
this.name = name;
}
public Name name(Integer name) {
this.name = name;
return this;

View File

@@ -86,6 +86,23 @@ public class Pet {
@JsonProperty("status")
private StatusEnum status;
/**
* Default constructor
* @deprecated Use {@link Pet#Pet(String, Set<String>)}
*/
@Deprecated
public Pet() {
super();
}
/**
* Constructor with only required parameters
*/
public Pet(String name, Set<String> photoUrls) {
this.name = name;
this.photoUrls = photoUrls;
}
public Pet id(Long id) {
this.id = id;
return this;

View File

@@ -40,6 +40,26 @@ public class TypeHolderDefault {
@Valid
private List<Integer> arrayItem = new ArrayList<>();
/**
* Default constructor
* @deprecated Use {@link TypeHolderDefault#TypeHolderDefault(String, BigDecimal, Integer, Boolean, List<Integer>)}
*/
@Deprecated
public TypeHolderDefault() {
super();
}
/**
* Constructor with only required parameters
*/
public TypeHolderDefault(String stringItem, BigDecimal numberItem, Integer integerItem, Boolean boolItem, List<Integer> arrayItem) {
this.stringItem = stringItem;
this.numberItem = numberItem;
this.integerItem = integerItem;
this.boolItem = boolItem;
this.arrayItem = arrayItem;
}
public TypeHolderDefault stringItem(String stringItem) {
this.stringItem = stringItem;
return this;

View File

@@ -43,6 +43,27 @@ public class TypeHolderExample {
@Valid
private List<Integer> arrayItem = new ArrayList<>();
/**
* Default constructor
* @deprecated Use {@link TypeHolderExample#TypeHolderExample(String, BigDecimal, Float, Integer, Boolean, List<Integer>)}
*/
@Deprecated
public TypeHolderExample() {
super();
}
/**
* Constructor with only required parameters
*/
public TypeHolderExample(String stringItem, BigDecimal numberItem, Float floatItem, Integer integerItem, Boolean boolItem, List<Integer> arrayItem) {
this.stringItem = stringItem;
this.numberItem = numberItem;
this.floatItem = floatItem;
this.integerItem = integerItem;
this.boolItem = boolItem;
this.arrayItem = arrayItem;
}
public TypeHolderExample stringItem(String stringItem) {
this.stringItem = stringItem;
return this;