forked from loafle/openapi-generator-original
hashCode and equals support for jdk6 for jersey2 (#4039)
This commit is contained in:
parent
f70569987a
commit
aeb33e4b6e
@ -111,6 +111,10 @@ ext {
|
||||
{{^java8}}
|
||||
jodatime_version = "2.9.4"
|
||||
{{/java8}}
|
||||
{{#supportJava6}}
|
||||
commons_io_version=2.5
|
||||
commons_lang3_version=3.5
|
||||
{{/supportJava6}}
|
||||
junit_version = "4.12"
|
||||
}
|
||||
|
||||
@ -129,6 +133,10 @@ dependencies {
|
||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||
compile "joda-time:joda-time:$jodatime_version"
|
||||
{{/java8}}
|
||||
{{#supportJava6}}
|
||||
compile "commons-io:commons-io:$commons_io_version"
|
||||
compile "org.apache.commons:commons-lang3:$commons_lang3_version"
|
||||
{{/supportJava6}}
|
||||
compile "com.brsanthu:migbase64:2.2"
|
||||
testCompile "junit:junit:$junit_version"
|
||||
}
|
||||
|
@ -24,6 +24,10 @@ lazy val root = (project in file(".")).
|
||||
"joda-time" % "joda-time" % "2.9.4",
|
||||
{{/java8}}
|
||||
"com.brsanthu" % "migbase64" % "2.2",
|
||||
{{#supportJava6}}
|
||||
"org.apache.commons" % "commons-lang3" % "3.5",
|
||||
"commons-io" % "commons-io" % "2.5",
|
||||
{{/supportJava6}}
|
||||
"junit" % "junit" % "4.12" % "test",
|
||||
"com.novocode" % "junit-interface" % "0.10" % "test"
|
||||
)
|
||||
|
@ -183,6 +183,19 @@
|
||||
<artifactId>migbase64</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
{{#supportJava6}}
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons_lang3_version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons_io_version}</version>
|
||||
</dependency>
|
||||
{{/supportJava6}}
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
@ -199,6 +212,10 @@
|
||||
{{^java8}}
|
||||
<jodatime-version>2.9.4</jodatime-version>
|
||||
{{/java8}}
|
||||
{{#supportJava6}}
|
||||
<commons_io_version>2.5</commons_io_version>
|
||||
<commons_lang3_version>3.5</commons_lang3_version>
|
||||
{{/supportJava6}}
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
</properties>
|
||||
|
@ -5,6 +5,9 @@ package {{package}};
|
||||
{{^supportJava6}}
|
||||
import java.util.Objects;
|
||||
{{/supportJava6}}
|
||||
{{#supportJava6}}
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
{{/supportJava6}}
|
||||
{{#imports}}
|
||||
import {{import}};
|
||||
{{/imports}}
|
||||
|
@ -101,6 +101,29 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
|
||||
}
|
||||
|
||||
{{/supportJava6}}
|
||||
{{#supportJava6}}
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}{{#hasVars}}
|
||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||
return {{#vars}}ObjectUtils.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
|
||||
{{/hasMore}}{{/vars}}{{#parent}} &&
|
||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||
return true;{{/hasVars}}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
||||
}
|
||||
|
||||
{{/supportJava6}}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -181,6 +181,20 @@
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
{{#supportJava6}}
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons_lang3_version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons_io_version}</version>
|
||||
</dependency>
|
||||
{{/supportJava6}}
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@ -197,6 +211,10 @@
|
||||
{{^java8}}
|
||||
<jodatime-version>2.9.4</jodatime-version>
|
||||
{{/java8}}
|
||||
{{#supportJava6}}
|
||||
<commons_io_version>2.5</commons_io_version>
|
||||
<commons_lang3_version>3.5</commons_lang3_version>
|
||||
{{/supportJava6}}
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
</properties>
|
||||
|
Loading…
x
Reference in New Issue
Block a user