add back setter to spring model (readonly attr)

This commit is contained in:
wing328 2016-11-02 15:40:00 +08:00
parent 52736ddaeb
commit 4eb75f8088
22 changed files with 147 additions and 16 deletions

View File

@ -27,7 +27,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{/vars}}
{{#vars}}
{{^isReadOnly}}
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
this.{{name}} = {{name}};
return this;
@ -47,7 +46,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
}
{{/isMapContainer}}
{{/isReadOnly}}
/**
{{#description}}
* {{{description}}}
@ -70,12 +68,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}}

View File

@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;

View File

@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;

View File

@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Client;
import java.time.OffsetDateTime;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.math.BigDecimal;
import io.swagger.annotations.*;

View File

@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;

View File

@ -17,6 +17,11 @@ public class HasOnlyReadOnly {
@JsonProperty("foo")
private String foo = null;
public HasOnlyReadOnly bar(String bar) {
this.bar = bar;
return this;
}
/**
* Get bar
* @return bar
@ -26,6 +31,15 @@ public class HasOnlyReadOnly {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public HasOnlyReadOnly foo(String foo) {
this.foo = foo;
return this;
}
/**
* Get foo
* @return foo
@ -35,6 +49,10 @@ public class HasOnlyReadOnly {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
@Override
public boolean equals(java.lang.Object o) {

View File

@ -42,6 +42,11 @@ public class Name {
this.name = name;
}
public Name snakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
return this;
}
/**
* Get snakeCase
* @return snakeCase
@ -51,6 +56,10 @@ public class Name {
return snakeCase;
}
public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}
public Name property(String property) {
this.property = property;
return this;
@ -69,6 +78,11 @@ public class Name {
this.property = property;
}
public Name _123Number(Integer _123Number) {
this._123Number = _123Number;
return this;
}
/**
* Get _123Number
* @return _123Number
@ -78,6 +92,10 @@ public class Name {
return _123Number;
}
public void set123Number(Integer _123Number) {
this._123Number = _123Number;
}
@Override
public boolean equals(java.lang.Object o) {

View File

@ -17,6 +17,11 @@ public class ReadOnlyFirst {
@JsonProperty("baz")
private String baz = null;
public ReadOnlyFirst bar(String bar) {
this.bar = bar;
return this;
}
/**
* Get bar
* @return bar
@ -26,6 +31,10 @@ public class ReadOnlyFirst {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public ReadOnlyFirst baz(String baz) {
this.baz = baz;
return this;

View File

@ -2,8 +2,8 @@ package io.swagger.api;
import io.swagger.model.Client;
import org.joda.time.LocalDate;
import java.math.BigDecimal;
import org.joda.time.DateTime;
import java.math.BigDecimal;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;

View File

@ -2,8 +2,8 @@ package io.swagger.api;
import io.swagger.model.Client;
import org.joda.time.LocalDate;
import java.math.BigDecimal;
import org.joda.time.DateTime;
import java.math.BigDecimal;
import io.swagger.annotations.*;

View File

@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;

View File

@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.annotations.*;

View File

@ -17,6 +17,11 @@ public class HasOnlyReadOnly {
@JsonProperty("foo")
private String foo = null;
public HasOnlyReadOnly bar(String bar) {
this.bar = bar;
return this;
}
/**
* Get bar
* @return bar
@ -26,6 +31,15 @@ public class HasOnlyReadOnly {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public HasOnlyReadOnly foo(String foo) {
this.foo = foo;
return this;
}
/**
* Get foo
* @return foo
@ -35,6 +49,10 @@ public class HasOnlyReadOnly {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
@Override
public boolean equals(java.lang.Object o) {

View File

@ -42,6 +42,11 @@ public class Name {
this.name = name;
}
public Name snakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
return this;
}
/**
* Get snakeCase
* @return snakeCase
@ -51,6 +56,10 @@ public class Name {
return snakeCase;
}
public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}
public Name property(String property) {
this.property = property;
return this;
@ -69,6 +78,11 @@ public class Name {
this.property = property;
}
public Name _123Number(Integer _123Number) {
this._123Number = _123Number;
return this;
}
/**
* Get _123Number
* @return _123Number
@ -78,6 +92,10 @@ public class Name {
return _123Number;
}
public void set123Number(Integer _123Number) {
this._123Number = _123Number;
}
@Override
public boolean equals(java.lang.Object o) {

View File

@ -17,6 +17,11 @@ public class ReadOnlyFirst {
@JsonProperty("baz")
private String baz = null;
public ReadOnlyFirst bar(String bar) {
this.bar = bar;
return this;
}
/**
* Get bar
* @return bar
@ -26,6 +31,10 @@ public class ReadOnlyFirst {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public ReadOnlyFirst baz(String baz) {
this.baz = baz;
return this;

View File

@ -2,8 +2,8 @@ package io.swagger.api;
import io.swagger.model.Client;
import org.joda.time.LocalDate;
import java.math.BigDecimal;
import org.joda.time.DateTime;
import java.math.BigDecimal;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;

View File

@ -2,8 +2,8 @@ package io.swagger.api;
import io.swagger.model.Client;
import org.joda.time.LocalDate;
import java.math.BigDecimal;
import org.joda.time.DateTime;
import java.math.BigDecimal;
import io.swagger.annotations.*;

View File

@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;

View File

@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.annotations.*;

View File

@ -17,6 +17,11 @@ public class HasOnlyReadOnly {
@JsonProperty("foo")
private String foo = null;
public HasOnlyReadOnly bar(String bar) {
this.bar = bar;
return this;
}
/**
* Get bar
* @return bar
@ -26,6 +31,15 @@ public class HasOnlyReadOnly {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public HasOnlyReadOnly foo(String foo) {
this.foo = foo;
return this;
}
/**
* Get foo
* @return foo
@ -35,6 +49,10 @@ public class HasOnlyReadOnly {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
@Override
public boolean equals(java.lang.Object o) {

View File

@ -42,6 +42,11 @@ public class Name {
this.name = name;
}
public Name snakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
return this;
}
/**
* Get snakeCase
* @return snakeCase
@ -51,6 +56,10 @@ public class Name {
return snakeCase;
}
public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}
public Name property(String property) {
this.property = property;
return this;
@ -69,6 +78,11 @@ public class Name {
this.property = property;
}
public Name _123Number(Integer _123Number) {
this._123Number = _123Number;
return this;
}
/**
* Get _123Number
* @return _123Number
@ -78,6 +92,10 @@ public class Name {
return _123Number;
}
public void set123Number(Integer _123Number) {
this._123Number = _123Number;
}
@Override
public boolean equals(java.lang.Object o) {

View File

@ -17,6 +17,11 @@ public class ReadOnlyFirst {
@JsonProperty("baz")
private String baz = null;
public ReadOnlyFirst bar(String bar) {
this.bar = bar;
return this;
}
/**
* Get bar
* @return bar
@ -26,6 +31,10 @@ public class ReadOnlyFirst {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public ReadOnlyFirst baz(String baz) {
this.baz = baz;
return this;