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
52 changed files with 884 additions and 33 deletions

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;