Add "equals" and "hashCode" methods to Java clients

for the "retrofit" and "retrofit2" libraries
This commit is contained in:
xhh
2015-11-23 19:59:44 +08:00
parent 2e51aa5076
commit f2a8955926
26 changed files with 378 additions and 30 deletions

View File

@@ -45,8 +45,12 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
{{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}}
return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
{{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}}