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

Generate setters for readonly properties in server code #1582

Merged
merged 4 commits into from
Mar 31, 2019
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 @@ -11,7 +11,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{/isContainer}}
{{#isContainer}}
{{#mostInnerItems}}
{{>enumClass}}
{{>enumClass}}
{{/mostInnerItems}}
{{/isContainer}}
{{/isEnum}}
Expand All @@ -30,7 +30,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali

{{/vars}}
{{#vars}}
{{^isReadOnly}}
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
this.{{name}} = {{name}};
return this;
Expand Down Expand Up @@ -60,7 +59,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
}
{{/isMapContainer}}

{{/isReadOnly}}
/**
{{#description}}
* {{description}}
Expand All @@ -87,12 +85,10 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}};
}
{{^isReadOnly}}

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

{{/vars}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static ArrayEnumEnum fromValue(String text) {
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

@JsonProperty("array_enum")
private List<ArrayEnumEnum> arrayEnum = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public class HasOnlyReadOnly implements Serializable {
@JsonProperty("foo")
private String foo;

public HasOnlyReadOnly bar(String bar) {
this.bar = bar;
return this;
}

/**
* Get bar
* @return bar
Expand All @@ -44,6 +49,15 @@ public String getBar() {
return bar;
}

public void setBar(String bar) {
this.bar = bar;
}

public HasOnlyReadOnly foo(String foo) {
this.foo = foo;
return this;
}

/**
* Get foo
* @return foo
Expand All @@ -55,6 +69,10 @@ public String getFoo() {
return foo;
}

public void setFoo(String foo) {
this.foo = foo;
}


@Override
public boolean equals(java.lang.Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static InnerEnum fromValue(String text) {
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

@JsonProperty("map_of_enum_string")
private Map<String, InnerEnum> mapOfEnumString = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public void setName(Integer name) {
this.name = name;
}

public Name snakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
return this;
}

/**
* Get snakeCase
* @return snakeCase
Expand All @@ -72,6 +77,10 @@ public Integer getSnakeCase() {
return snakeCase;
}

public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}

public Name property(String property) {
this.property = property;
return this;
Expand All @@ -92,6 +101,11 @@ public void setProperty(String property) {
this.property = property;
}

public Name _123number(Integer _123number) {
this._123number = _123number;
return this;
}

/**
* Get _123number
* @return _123number
Expand All @@ -103,6 +117,10 @@ public Integer get123number() {
return _123number;
}

public void set123number(Integer _123number) {
this._123number = _123number;
}


@Override
public boolean equals(java.lang.Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public class ReadOnlyFirst implements Serializable {
@JsonProperty("baz")
private String baz;

public ReadOnlyFirst bar(String bar) {
this.bar = bar;
return this;
}

/**
* Get bar
* @return bar
Expand All @@ -44,6 +49,10 @@ public String getBar() {
return bar;
}

public void setBar(String bar) {
this.bar = bar;
}

public ReadOnlyFirst baz(String baz) {
this.baz = baz;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static ArrayEnumEnum fromValue(String text) {
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

@JsonProperty("array_enum")
private List<ArrayEnumEnum> arrayEnum = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class HasOnlyReadOnly {
@JsonProperty("foo")
private String foo;

public HasOnlyReadOnly bar(String bar) {
this.bar = bar;
return this;
}

/**
* Get bar
* @return bar
Expand All @@ -43,6 +48,15 @@ public String getBar() {
return bar;
}

public void setBar(String bar) {
this.bar = bar;
}

public HasOnlyReadOnly foo(String foo) {
this.foo = foo;
return this;
}

/**
* Get foo
* @return foo
Expand All @@ -54,6 +68,10 @@ public String getFoo() {
return foo;
}

public void setFoo(String foo) {
this.foo = foo;
}


@Override
public boolean equals(java.lang.Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static EnumFormStringArrayEnum fromValue(String text) {
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

@JsonProperty("enum_form_string_array")
private List<EnumFormStringArrayEnum> enumFormStringArray = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static InnerEnum fromValue(String text) {
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

@JsonProperty("map_of_enum_string")
private Map<String, InnerEnum> mapOfEnumString = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public void setName(Integer name) {
this.name = name;
}

public Name snakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
return this;
}

/**
* Get snakeCase
* @return snakeCase
Expand All @@ -71,6 +76,10 @@ public Integer getSnakeCase() {
return snakeCase;
}

public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}

public Name property(String property) {
this.property = property;
return this;
Expand All @@ -91,6 +100,11 @@ public void setProperty(String property) {
this.property = property;
}

public Name _123number(Integer _123number) {
this._123number = _123number;
return this;
}

/**
* Get _123number
* @return _123number
Expand All @@ -102,6 +116,10 @@ public Integer get123number() {
return _123number;
}

public void set123number(Integer _123number) {
this._123number = _123number;
}


@Override
public boolean equals(java.lang.Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class ReadOnlyFirst {
@JsonProperty("baz")
private String baz;

public ReadOnlyFirst bar(String bar) {
this.bar = bar;
return this;
}

/**
* Get bar
* @return bar
Expand All @@ -43,6 +48,10 @@ public String getBar() {
return bar;
}

public void setBar(String bar) {
this.bar = bar;
}

public ReadOnlyFirst baz(String baz) {
this.baz = baz;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static ArrayEnumEnum fromValue(String text) {
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

@JsonProperty("array_enum")
private List<ArrayEnumEnum> arrayEnum = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class HasOnlyReadOnly {
@JsonProperty("foo")
private String foo;

public HasOnlyReadOnly bar(String bar) {
this.bar = bar;
return this;
}

/**
* Get bar
* @return bar
Expand All @@ -43,6 +48,15 @@ public String getBar() {
return bar;
}

public void setBar(String bar) {
this.bar = bar;
}

public HasOnlyReadOnly foo(String foo) {
this.foo = foo;
return this;
}

/**
* Get foo
* @return foo
Expand All @@ -54,6 +68,10 @@ public String getFoo() {
return foo;
}

public void setFoo(String foo) {
this.foo = foo;
}


@Override
public boolean equals(java.lang.Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static InnerEnum fromValue(String text) {
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

@JsonProperty("map_of_enum_string")
private Map<String, InnerEnum> mapOfEnumString = null;

Expand Down
Loading