Skip to content

Commit

Permalink
generate all args constructor enabled by default (why not?)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfinne committed Mar 25, 2024
1 parent d3310a5 commit 8c0521d
Show file tree
Hide file tree
Showing 1,769 changed files with 16,541 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected boolean camelCaseDollarSign = false;
protected boolean useJakartaEe = false;
protected boolean containerDefaultToNull = false;

protected boolean generatedConstructorWithAllArgs = true;
private Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
protected boolean generatedConstructorWithAllArgs;

public AbstractJavaCodegen() {
super();
Expand Down Expand Up @@ -283,7 +282,7 @@ public AbstractJavaCodegen() {
cliOptions.add(CliOption.newBoolean(CAMEL_CASE_DOLLAR_SIGN, "Fix camelCase when starting with $ sign. when true : $Value when false : $value"));
cliOptions.add(CliOption.newBoolean(USE_JAKARTA_EE, "whether to use Jakarta EE namespace instead of javax"));
cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null"));
cliOptions.add(CliOption.newBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, "whether to generate a constructor for all arguments").defaultValue(Boolean.FALSE.toString()));
cliOptions.add(CliOption.newBoolean(GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, "whether to generate a constructor for all arguments").defaultValue(Boolean.TRUE.toString()));

cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/withXml}}
{{/vendorExtensions.x-has-readonly-properties}}
{{#vendorExtensions.generatedConstructorWithAllArgs}}

/**
* Constructor with all args parameters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{/generatedConstructorWithRequiredArgs}}
{{/lombok.RequiredArgsConstructor}}
{{#vendorExtensions.generatedConstructorWithAllArgs}}

/**
* Constructor with all args parameters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public class Bird {
public Bird() {
}

/**
* Constructor with all args parameters
*/
public Bird(String size, String color) {
this.size = size;
this.color = color;
}

public Bird size(String size) {

this.size = size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public class Category {
public Category() {
}

/**
* Constructor with all args parameters
*/
public Category(Long id, String name) {
this.id = id;
this.name = name;
}

public Category id(Long id) {

this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ public DataQuery() {

}

/**
* Constructor with all args parameters
*/
public DataQuery(String suffix, String text, OffsetDateTime date, Long id, List<OutcomesEnum> outcomes) {
super(id, outcomes);
this.suffix = suffix;
this.text = text;
this.date = date;
}

public DataQuery suffix(String suffix) {

this.suffix = suffix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ public static ArrayStringEnumDefaultEnum fromValue(String value) {
public DefaultValue() {
}

/**
* Constructor with all args parameters
*/
public DefaultValue(List<StringEnumRef> arrayStringEnumRefDefault, List<ArrayStringEnumDefaultEnum> arrayStringEnumDefault, List<String> arrayStringDefault, List<Integer> arrayIntegerDefault, List<String> arrayString, List<String> arrayStringNullable, List<String> arrayStringExtensionNullable, String stringNullable) {
this.arrayStringEnumRefDefault = arrayStringEnumRefDefault;
this.arrayStringEnumDefault = arrayStringEnumDefault;
this.arrayStringDefault = arrayStringDefault;
this.arrayIntegerDefault = arrayIntegerDefault;
this.arrayString = arrayString;
this.arrayStringNullable = arrayStringNullable == null ? JsonNullable.<List<String>>undefined() : JsonNullable.of(arrayStringNullable);
this.arrayStringExtensionNullable = arrayStringExtensionNullable == null ? JsonNullable.<List<String>>undefined() : JsonNullable.of(arrayStringExtensionNullable);
this.stringNullable = stringNullable == null ? JsonNullable.<String>undefined() : JsonNullable.of(stringNullable);
}

public DefaultValue arrayStringEnumRefDefault(List<StringEnumRef> arrayStringEnumRefDefault) {

this.arrayStringEnumRefDefault = arrayStringEnumRefDefault;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ public class NumberPropertiesOnly {
public NumberPropertiesOnly() {
}

/**
* Constructor with all args parameters
*/
public NumberPropertiesOnly(BigDecimal number, Float _float, Double _double) {
this.number = number;
this._float = _float;
this._double = _double;
}

public NumberPropertiesOnly number(BigDecimal number) {

this.number = number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ public static StatusEnum fromValue(String value) {
public Pet() {
}

/**
* Constructor with all args parameters
*/
public Pet(Long id, String name, Category category, List<String> photoUrls, List<Tag> tags, StatusEnum status) {
this.id = id;
this.name = name;
this.category = category;
this.photoUrls = photoUrls;
this.tags = tags;
this.status = status;
}

public Pet id(Long id) {

this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ public static OutcomesEnum fromValue(String value) {
public Query() {
}

/**
* Constructor with all args parameters
*/
public Query(Long id, List<OutcomesEnum> outcomes) {
this.id = id;
this.outcomes = outcomes;
}

public Query id(Long id) {

this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public class Tag {
public Tag() {
}

/**
* Constructor with all args parameters
*/
public Tag(Long id, String name) {
this.id = id;
this.name = name;
}

public Tag id(Long id) {

this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() {
}

/**
* Constructor with all args parameters
*/
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(String size, String color, Long id, String name) {
this.size = size;
this.color = color;
this.id = id;
this.name = name;
}

public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter size(String size) {

this.size = size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() {
}

/**
* Constructor with all args parameters
*/
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(List<String> values) {
this.values = values;
}

public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter values(List<String> values) {

this.values = values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public class Bird {
public Bird() {
}

/**
* Constructor with all args parameters
*/
public Bird(String size, String color) {
this.size = size;
this.color = color;
}

public Bird size(String size) {

this.size = size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public class Category {
public Category() {
}

/**
* Constructor with all args parameters
*/
public Category(Long id, String name) {
this.id = id;
this.name = name;
}

public Category id(Long id) {

this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ public DataQuery() {

}

/**
* Constructor with all args parameters
*/
public DataQuery(String suffix, String text, OffsetDateTime date, Long id, List<OutcomesEnum> outcomes) {
super(id, outcomes);
this.suffix = suffix;
this.text = text;
this.date = date;
}

public DataQuery suffix(String suffix) {

this.suffix = suffix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ public static ArrayStringEnumDefaultEnum fromValue(String value) {
public DefaultValue() {
}

/**
* Constructor with all args parameters
*/
public DefaultValue(List<StringEnumRef> arrayStringEnumRefDefault, List<ArrayStringEnumDefaultEnum> arrayStringEnumDefault, List<String> arrayStringDefault, List<Integer> arrayIntegerDefault, List<String> arrayString, List<String> arrayStringNullable, List<String> arrayStringExtensionNullable, String stringNullable) {
this.arrayStringEnumRefDefault = arrayStringEnumRefDefault;
this.arrayStringEnumDefault = arrayStringEnumDefault;
this.arrayStringDefault = arrayStringDefault;
this.arrayIntegerDefault = arrayIntegerDefault;
this.arrayString = arrayString;
this.arrayStringNullable = arrayStringNullable == null ? JsonNullable.<List<String>>undefined() : JsonNullable.of(arrayStringNullable);
this.arrayStringExtensionNullable = arrayStringExtensionNullable == null ? JsonNullable.<List<String>>undefined() : JsonNullable.of(arrayStringExtensionNullable);
this.stringNullable = stringNullable == null ? JsonNullable.<String>undefined() : JsonNullable.of(stringNullable);
}

public DefaultValue arrayStringEnumRefDefault(List<StringEnumRef> arrayStringEnumRefDefault) {

this.arrayStringEnumRefDefault = arrayStringEnumRefDefault;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ public class NumberPropertiesOnly {
public NumberPropertiesOnly() {
}

/**
* Constructor with all args parameters
*/
public NumberPropertiesOnly(BigDecimal number, Float _float, Double _double) {
this.number = number;
this._float = _float;
this._double = _double;
}

public NumberPropertiesOnly number(BigDecimal number) {

this.number = number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ public static StatusEnum fromValue(String value) {
public Pet() {
}

/**
* Constructor with all args parameters
*/
public Pet(Long id, String name, Category category, List<String> photoUrls, List<Tag> tags, StatusEnum status) {
this.id = id;
this.name = name;
this.category = category;
this.photoUrls = photoUrls;
this.tags = tags;
this.status = status;
}

public Pet id(Long id) {

this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ public static OutcomesEnum fromValue(String value) {
public Query() {
}

/**
* Constructor with all args parameters
*/
public Query(Long id, List<OutcomesEnum> outcomes) {
this.id = id;
this.outcomes = outcomes;
}

public Query id(Long id) {

this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public class Tag {
public Tag() {
}

/**
* Constructor with all args parameters
*/
public Tag(Long id, String name) {
this.id = id;
this.name = name;
}

public Tag id(Long id) {

this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() {
}

/**
* Constructor with all args parameters
*/
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(String size, String color, Long id, String name) {
this.size = size;
this.color = color;
this.id = id;
this.name = name;
}

public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter size(String size) {

this.size = size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() {
}

/**
* Constructor with all args parameters
*/
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(List<String> values) {
this.values = values;
}

public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter values(List<String> values) {

this.values = values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Bird {

public Bird() {
}

/**
* Constructor with all args parameters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Category {

public Category() {
}

/**
* Constructor with all args parameters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class DataQuery extends Query {
public DataQuery() {

}

/**
* Constructor with all args parameters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public static ArrayStringEnumDefaultEnum fromValue(String value) {

public DefaultValue() {
}

/**
* Constructor with all args parameters
*/
Expand Down
Loading

0 comments on commit 8c0521d

Please sign in to comment.