1+ /**
2+ * { {#description} }{ {.} }{ {/description} }{ {^description} }{ {classname} }{ {/description} }
3+ */{ {#description} }
4+ @ApiModel(description = "{ {{description} }}"){ {/description} }
5+ { {> generatedAnnotation} }{ {#discriminator} }{ {> typeInfoAnnotation} }{ {/discriminator} }{ {> xmlAnnotation} }{ {> additionalModelTypeAnnotations} }
6+ public class { {classname} } { {#parent} }extends { {{parent} }}{ {/parent} }{ {^parent} }{ {#hateoas} }extends RepresentationModel<{ {classname} }> { {/hateoas} }{ {/parent} } { {#serializableModel} }implements Serializable{ {/serializableModel} } {
7+ {{#serializableModel} }
8+ private static final long serialVersionUID = 1L;
9+
10+ { {/serializableModel} }
11+
12+ public { {classname} }({ {#vars} } { {{datatypeWithEnum} }} { {name} }{ {^-last} },{ {/-last} }{ {#-last} }){ {{/-last} } { {/vars} }
13+ { {! the loop which assigns this.x = x for each of the params defined } }
14+ { {#vars} }
15+ this.{ {name} } = { {name} };
16+ { {/vars} }
17+ { {#vars} }{ {#-last} }
18+ }{ {/-last} }{ {/vars} }
19+
20+ { {! if you add the above you might want to also add a no-args constructor } }
21+ public { {classname} }() {
22+ super();
23+ }
24+
25+ { {#vars} }
26+ { {#isEnum} }
27+ { {^isContainer} }
28+ { {> enumClass} }
29+ { {/isContainer} }
30+ { {#isContainer} }
31+ { {#mostInnerItems} }
32+ { {> enumClass} }
33+ { {/mostInnerItems} }
34+ { {/isContainer} }
35+ { {/isEnum} }
36+ { {#jackson} }
37+ @JsonProperty("{ {baseName} }"){ {#withXml} }
38+ @JacksonXmlProperty({ {#isXmlAttribute} }isAttribute = true, { {/isXmlAttribute} }{ {#xmlNamespace} }namespace="{ {xmlNamespace} }", { {/xmlNamespace} }localName = "{ {#xmlName} }{ {xmlName} }{ {/xmlName} }{ {^xmlName} }{ {baseName} }{ {/xmlName} }"){ {/withXml} }
39+ { {/jackson} }
40+ { {#gson} }
41+ @SerializedName("{ {baseName} }")
42+ { {/gson} }
43+ { {#isContainer} }
44+ { {#useBeanValidation} }@Valid{ {/useBeanValidation} }
45+ { {#openApiNullable} }
46+ private { {> nullableDataType} } { {name} } = { {#isNullable} }JsonNullable.undefined(){ {/isNullable} }{ {^isNullable} }{ {#required} }{ {{defaultValue} }}{ {/required} }{ {^required} }null{ {/required} }{ {/isNullable} };
47+ { {/openApiNullable} }
48+ { {^openApiNullable} }
49+ private { {> nullableDataType} } { {name} } = { {#required} }{ {{defaultValue} }}{ {/required} }{ {^required} }null{ {/required} };
50+ { {/openApiNullable} }
51+ { {/isContainer} }
52+ { {^isContainer} }
53+ { {#isDate} }
54+ @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
55+ { {/isDate} }
56+ { {#isDateTime} }
57+ @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
58+ { {/isDateTime} }
59+ { {#openApiNullable} }
60+ private { {> nullableDataType} } { {name} }{ {#isNullable} } = JsonNullable.undefined(){ {/isNullable} }{ {^isNullable} }{ {#defaultValue} } = { {{.} }}{ {/defaultValue} }{ {/isNullable} };
61+ { {/openApiNullable} }
62+ { {^openApiNullable} }
63+ private { {> nullableDataType} } { {name} }{ {#isNullable} } = null{ {/isNullable} }{ {^isNullable} }{ {#defaultValue} } = { {{.} }}{ {/defaultValue} }{ {/isNullable} };
64+ { {/openApiNullable} }
65+ { {/isContainer} }
66+
67+ { {/vars} }
68+ { {#vars} }
69+ public { {classname} } { {name} }({ {{datatypeWithEnum} }} { {name} }) {
70+ {{#openApiNullable} }
71+ this.{ {name} } = { {#isNullable} }JsonNullable.of({ {name} }){ {/isNullable} }{ {^isNullable} }{ {name} }{ {/isNullable} };
72+ { {/openApiNullable} }
73+ { {^openApiNullable} }
74+ this.{ {name} } = { {name} };
75+ { {/openApiNullable} }
76+ return this;
77+ }
78+ { {#isArray} }
79+
80+ public { {classname} } add{ {nameInCamelCase} }Item({ {{items.datatypeWithEnum} }} { {name} }Item) {
81+ {{#openApiNullable} }
82+ { {^required} }
83+ if (this.{ {name} } == null{ {#isNullable} } || !this.{ {name} }.isPresent(){ {/isNullable} }) {
84+ this.{{name} } = { {#isNullable} }JsonNullable.of({ {{defaultValue} }}){ {/isNullable} }{ {^isNullable} }{ {{defaultValue} }}{ {/isNullable} };
85+ }
86+ { {/required} }
87+ this.{ {name} }{ {#isNullable} }.get(){ {/isNullable} }.add({ {name} }Item);
88+ { {/openApiNullable} }
89+ { {^openApiNullable} }
90+ if (this.{ {name} } == null) {
91+ this.{{name} } = { {{defaultValue} }};
92+ }
93+ this.{ {name} }.add({ {name} }Item);
94+ { {/openApiNullable} }
95+ return this;
96+ }
97+ { {/isArray} }
98+ { {#isMap} }
99+
100+ public { {classname} } put{ {nameInCamelCase} }Item(String key, { {{items.datatypeWithEnum} }} { {name} }Item) {
101+ {{^required} }
102+ if (this.{ {name} } == null) {
103+ this.{{name} } = { {{defaultValue} }};
104+ }
105+ { {/required} }
106+ this.{ {name} }.put(key, { {name} }Item);
107+ return this;
108+ }
109+ { {/isMap} }
110+
111+ /**
112+ { {#description} }
113+ * { {{description} }}
114+ { {/description} }
115+ { {^description} }
116+ * Get { {name} }
117+ { {/description} }
118+ { {#minimum} }
119+ * minimum: { {minimum} }
120+ { {/minimum} }
121+ { {#maximum} }
122+ * maximum: { {maximum} }
123+ { {/maximum} }
124+ * @return { {name} }
125+ */
126+ { {#vendorExtensions.x-extra-annotation} }
127+ { {{vendorExtensions.x-extra-annotation} }}
128+ { {/vendorExtensions.x-extra-annotation} }
129+ @ApiModelProperty({ {#example} }example = "{ {{example} }}", { {/example} }{ {#required} }required = { {required} }, { {/required} }{ {#isReadOnly} }readOnly = { {{isReadOnly} }}, { {/isReadOnly} }value = "{ {{description} }}")
130+ { {#useBeanValidation} }{ {> beanValidation} }{ {/useBeanValidation} } public { {> nullableDataType} } { {getter} }() {
131+ return {{name} };
132+ }
133+
134+ public void { {setter} }({ {> nullableDataType} } { {name} }) {
135+ this.{{name} } = { {name} };
136+ }
137+
138+ { {/vars} }
139+
140+ @Override
141+ public boolean equals(Object o) {
142+ if (this == o) {
143+ return true ;
144+ }
145+ if (o == null || getClass() != o.getClass()) {
146+ return false ;
147+ } { {#hasVars} }
148+ { {classname} } { {classVarName} } = ({ {classname} }) o;
149+ return { {#vars} }{ {#isByteArray} }Arrays{ {/isByteArray} }{ {^isByteArray} }Objects{ {/isByteArray} }.equals(this.{ {name} }, { {classVarName} }.{ {name} }){ {^-last} } &&
150+ { {/-last} }{ {/vars} }{ {#parent} } &&
151+ super.equals(o){ {/parent} };{ {/hasVars} }{ {^hasVars} }
152+ return true;{ {/hasVars} }
153+ }
154+
155+ @Override
156+ public int hashCode() {
157+ return Objects.hash({{#vars} }{ {^isByteArray} }{ {name} }{ {/isByteArray} }{ {#isByteArray} }Arrays.hashCode({ {name} }){ {/isByteArray} }{ {^-last} }, { {/-last} }{ {/vars} }{ {#parent} }{ {#hasVars} }, { {/hasVars} }super.hashCode(){ {/parent} });
158+ }
159+
160+ @Override
161+ public String toString() {
162+ StringBuilder sb = new StringBuilder();
163+ sb.append(" class {{classname}} {\n " );
164+ {{#parent} }sb.append(" ").append(toIndentedString(super.toString())).append("\n");{ {/parent} }
165+ { {#vars} }sb.append(" { {name} }: ").append(toIndentedString({ {name} })).append("\n");
166+ { {/vars} }sb.append("}");
167+ return sb.toString();
168+ }
169+
170+ /**
171+ * Convert the given object to string with each line indented by 4 spaces
172+ * (except the first line).
173+ */
174+ private String toIndentedString(Object o) {
175+ if (o == null) {
176+ return " null" ;
177+ }
178+ return o.toString().replace("\n", "\n ");
179+ }
180+ }
0 commit comments