Add equals and hashCode methods to Microprofile (#20011)

* Add equals and hashCode methods to microprofile

* Add missing import

* Update samples

* Add missing dependency for reflection equals
This commit is contained in:
DielN 2024-11-10 10:43:19 +01:00 committed by GitHub
parent 824f864512
commit 2a17134628
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
52 changed files with 884 additions and 33 deletions

View File

@ -9,3 +9,4 @@ additionalProperties:
configKey: petstore
microprofileRestClientVersion: "3.0"
hideGenerationTimestamp: true
useReflectionEqualsHashCode: true

View File

@ -1,6 +1,12 @@
{{>licenseInfo}}
package {{package}};
{{#useReflectionEqualsHashCode}}
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
{{/useReflectionEqualsHashCode}}
import java.util.Objects;
import java.util.Arrays;
{{#imports}}import {{import}};
{{/imports}}
{{#serializableModel}}

View File

@ -148,28 +148,5 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
{{/isReadOnly}}
{{/vars}}
/**
* Create a string representation of this pojo.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class {{classname}} {\n");
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
{{#vars}}sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n");
{{/vars}}sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
{{>pojoOverrides}}
}

View File

@ -0,0 +1,64 @@
@Override
public boolean equals(Object o) {
{{#useReflectionEqualsHashCode}}
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
{{/useReflectionEqualsHashCode}}
{{^useReflectionEqualsHashCode}}
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}{{#hasVars}}
{{classname}} {{classVarName}} = ({{classname}}) o;
return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} &&
{{/-last}}{{/vars}}{{#parent}} &&
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
{{/useReflectionEqualsHashCode}}
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
@Override
public int hashCode() {
{{#useReflectionEqualsHashCode}}
return HashCodeBuilder.reflectionHashCode(this);
{{/useReflectionEqualsHashCode}}
{{^useReflectionEqualsHashCode}}
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
{{/useReflectionEqualsHashCode}}
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
/**
* Create a string representation of this pojo.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class {{classname}} {\n");
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
{{#vars}}sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n");
{{/vars}}sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

View File

@ -196,6 +196,14 @@
<version>${mutiny.version}</version>
</dependency>
{{/microprofileMutiny}}
{{#useReflectionEqualsHashCode}}
<!-- For equals and hashCode using reflection -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang3.version}</version>
</dependency>
{{/useReflectionEqualsHashCode}}
</dependencies>
<repositories>
<repository>
@ -210,6 +218,8 @@
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -238,9 +248,11 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
{{#microprofileMutiny}}
<mutiny.version>1.2.0</mutiny.version>
{{/microprofileMutiny}}
{{#useReflectionEqualsHashCode}}
<commons.lang3.version>3.17.0</commons.lang3.version>
{{/useReflectionEqualsHashCode}}
</properties>
</project>

View File

@ -189,6 +189,14 @@
<version>${jakarta.annotation.version}</version>
<scope>provided</scope>
</dependency>
{{#useReflectionEqualsHashCode}}
<!-- For equals and hashCode using reflection -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang3.version}</version>
</dependency>
{{/useReflectionEqualsHashCode}}
</dependencies>
<repositories>
<repository>
@ -203,6 +211,8 @@
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -231,6 +241,8 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
{{#useReflectionEqualsHashCode}}
<commons.lang3.version>3.17.0</commons.lang3.version>
{{/useReflectionEqualsHashCode}}
</properties>
</project>

View File

@ -152,6 +152,8 @@
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -175,6 +177,5 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -101,6 +103,23 @@ public class Category {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -133,6 +135,24 @@ public class ModelApiResponse {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -265,6 +267,27 @@ public class Order {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -293,6 +295,27 @@ public class Pet {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -101,6 +103,23 @@ public class Tag {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -290,6 +292,29 @@ public class User {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
/**
* Create a string representation of this pojo.

View File

@ -127,6 +127,12 @@
<version>${jakarta.annotation.version}</version>
<scope>provided</scope>
</dependency>
<!-- For equals and hashCode using reflection -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang3.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
@ -141,6 +147,8 @@
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -164,6 +172,6 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<commons.lang3.version>3.17.0</commons.lang3.version>
</properties>
</project>

View File

@ -12,6 +12,10 @@
package org.openapitools.client.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -86,6 +90,15 @@ public class Category {
return this;
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,10 @@
package org.openapitools.client.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -116,6 +120,15 @@ public class ModelApiResponse {
return this;
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,10 @@
package org.openapitools.client.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -238,6 +242,15 @@ public class Order {
return this;
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,10 @@
package org.openapitools.client.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -260,6 +264,15 @@ public class Pet {
return this;
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,10 @@
package org.openapitools.client.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -86,6 +90,15 @@ public class Tag {
return this;
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,10 @@
package org.openapitools.client.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -263,6 +267,15 @@ public class User {
return this;
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
/**
* Create a string representation of this pojo.

View File

@ -150,6 +150,8 @@
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -172,6 +174,5 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
import jakarta.json.bind.annotation.JsonbTypeSerializer;
@ -75,6 +77,23 @@ public class Category {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
import jakarta.json.bind.annotation.JsonbTypeSerializer;
@ -98,6 +100,24 @@ public class ModelApiResponse {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Date;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
@ -213,6 +215,27 @@ public class Order {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -235,6 +237,27 @@ public class Pet {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
import jakarta.json.bind.annotation.JsonbTypeSerializer;
@ -75,6 +77,23 @@ public class Tag {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
import jakarta.json.bind.annotation.JsonbTypeSerializer;
@ -216,6 +218,29 @@ public class User {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
/**
* Create a string representation of this pojo.

View File

@ -150,6 +150,8 @@
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -172,6 +174,5 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import org.openapitools.client.model.Status;
import java.lang.reflect.Type;
import javax.json.bind.annotation.JsonbTypeDeserializer;
@ -96,6 +98,24 @@ public class Cat {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Cat cat = (Cat) o;
return Objects.equals(this.id, cat.id) &&
Objects.equals(this.name, cat.name) &&
Objects.equals(this.status, cat.status);
}
@Override
public int hashCode() {
return Objects.hash(id, name, status);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import org.openapitools.client.model.Status;
import java.lang.reflect.Type;
import javax.json.bind.annotation.JsonbTypeDeserializer;
@ -96,6 +98,24 @@ public class Dog {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Dog dog = (Dog) o;
return Objects.equals(this.id, dog.id) &&
Objects.equals(this.name, dog.name) &&
Objects.equals(this.status, dog.status);
}
@Override
public int hashCode() {
return Objects.hash(id, name, status);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import javax.json.bind.annotation.JsonbTypeDeserializer;
import javax.json.bind.annotation.JsonbTypeSerializer;

View File

@ -150,6 +150,8 @@
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -172,6 +174,5 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
import jakarta.json.bind.annotation.JsonbTypeSerializer;
@ -75,6 +77,23 @@ public class Category {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
import jakarta.json.bind.annotation.JsonbTypeSerializer;
@ -98,6 +100,24 @@ public class ModelApiResponse {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Date;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
@ -213,6 +215,27 @@ public class Order {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -235,6 +237,27 @@ public class Pet {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
import jakarta.json.bind.annotation.JsonbTypeSerializer;
@ -75,6 +77,23 @@ public class Tag {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import jakarta.json.bind.annotation.JsonbTypeDeserializer;
import jakarta.json.bind.annotation.JsonbTypeSerializer;
@ -216,6 +218,29 @@ public class User {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
/**
* Create a string representation of this pojo.

View File

@ -150,6 +150,8 @@
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -172,6 +174,5 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import javax.json.bind.annotation.JsonbTypeDeserializer;
import javax.json.bind.annotation.JsonbTypeSerializer;
@ -75,6 +77,23 @@ public class Category {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import javax.json.bind.annotation.JsonbTypeDeserializer;
import javax.json.bind.annotation.JsonbTypeSerializer;
@ -98,6 +100,24 @@ public class ModelApiResponse {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Date;
import java.lang.reflect.Type;
import javax.json.bind.annotation.JsonbTypeDeserializer;
@ -213,6 +215,27 @@ public class Order {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -235,6 +237,27 @@ public class Pet {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import javax.json.bind.annotation.JsonbTypeDeserializer;
import javax.json.bind.annotation.JsonbTypeSerializer;
@ -75,6 +77,23 @@ public class Tag {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.lang.reflect.Type;
import javax.json.bind.annotation.JsonbTypeDeserializer;
import javax.json.bind.annotation.JsonbTypeSerializer;
@ -216,6 +218,29 @@ public class User {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
/**
* Create a string representation of this pojo.

View File

@ -146,6 +146,8 @@
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>5.10.2</junit.version>
@ -169,7 +171,6 @@
<jandex.maven.plugin.version>1.1.0</jandex.maven.plugin.version>
<maven.failsafe.plugin.version>2.6</maven.failsafe.plugin.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mutiny.version>1.2.0</mutiny.version>
</properties>
</project>

View File

@ -12,6 +12,8 @@
package org.openapitools.server.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -86,6 +88,23 @@ public class Category {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.server.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -116,6 +118,24 @@ public class ModelApiResponse {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.server.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -238,6 +240,27 @@ public class Order {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.server.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -260,6 +262,27 @@ public class Pet {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.server.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -86,6 +88,23 @@ public class Tag {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
/**
* Create a string representation of this pojo.

View File

@ -12,6 +12,8 @@
package org.openapitools.server.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -263,6 +265,29 @@ public class User {
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
/**
* Create a string representation of this pojo.