File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
client/deployment/src/main/resources/templates/libraries/microprofile Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 11{@org.openapitools.codegen.CodegenModel m}
22import com.fasterxml.jackson.annotation.JsonProperty;
3+ import java.util.Objects;
34
45{#if m.description}
56/**
@@ -135,6 +136,49 @@ public class {m.classname} {#if m.parent}extends {m.parent}{/if}{#if serializabl
135136 return sb.toString();
136137 }
137138
139+ {#if m.vars.size > 0}
140+ @Override
141+ public boolean equals(Object o) {
142+ if (this == o) return true;
143+ if (o == null || getClass() != o.getClass()) return false;
144+
145+ {m.classname} model = ({m.classname}) o;
146+
147+ {#if m.vars.size == 1}
148+ return Objects.equals({m.vars.0.name}, model.{m.vars.0.name});
149+ {#else}
150+ {#for v in m.vars}
151+ {#if v_isFirst}
152+ return Objects.equals({v.name}, model.{v.name}) &&
153+ {#else if v_isLast}
154+ Objects.equals({v.name}, model.{v.name});
155+ {#else}
156+ Objects.equals({v.name}, model.{v.name}) &&
157+ {/if}
158+ {/for}
159+ {/if}
160+ }
161+ {/if}
162+
163+ {#if m.vars.size > 0}
164+ @Override
165+ public int hashCode() {
166+ {#if m.vars.size == 1}
167+ return Objects.hash({m.vars.0.name});
168+ {#else}
169+ {#for v in m.vars}
170+ {#if v_isFirst}
171+ return Objects.hash({v.name},
172+ {#else if v_isLast}
173+ {v.name});
174+ {#else}
175+ {v.name},
176+ {/if}
177+ {/for}
178+ {/if}
179+ }
180+ {/if}
181+
138182 /**
139183 * Convert the given object to string with each line indented by 4 spaces
140184 * (except the first line).
You can’t perform that action at this time.
0 commit comments