I use this library on Quarkus https://docs.quarkiverse.io/quarkus-openapi-generator/dev/client.html
My class generated by the open api plugin doesnt have “hashCode” and “equals” methods but “toString” only..
I want to know how i can find the right template to copy to my resources directory for adding these methods by myself (using qute syntax) or are there other more fast alternative, please?
I need to make it using only a subset of fields in the comparation.
Let me know. The documentation link https://github.com/quarkiverse/quarkus-openapi-generator/tree/main/integration-tests/custom-templates doesn’t work.
This is my dependencies and pom configurations:
<dependency>
<groupId>io.quarkiverse.openapi.generator</groupId>
<artifactId>quarkus-openapi-generator</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>3.6.9</version>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
</plugin>
This is one pojo class generated without hashcode and equals:
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.lang.reflect.Type;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class DocumentDtoOutput {
private String uuid;
private Long version = 1l;
private String externalId;
private String description;
private String contentBase64;
private String documentGroup;
private String mimeType;
private Map<String, String> filenetIndexes;
private Map<String, String> longTermStoragIndex;
private String filenetDocumentClass;
private Boolean isToSign;
private Boolean isMandatory;
private Boolean isBankToSign;
public enum CopyTypeEnum {
COPIA_CLIENTE(String.valueOf("COPIA_CLIENTE")), COPIA_BANCA(String.valueOf("COPIA_BANCA")), EMPTY(String.valueOf(""));
-............ (some others code here)
public String getDescription() {
return description;
}
/**
* Set description
**/
public void setDescription(String description) {
this.description = description;
}
public DocumentDtoOutput description(String description) {
this.description = description;
return this;
}
/**
* File content in base64 string
* @return contentBase64
**/
@JsonProperty("contentBase64")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
public String getContentBase64() {
return contentBase64;
}
/**
* Set contentBase64
**/
public void setContentBase64(String contentBase64) {
this.contentBase64 = contentBase64;
}
public DocumentDtoOutput contentBase64(String contentBase64) {
this.contentBase64 = contentBase64;
return this;
}
/**
* Document group
* @return documentGroup
**/
@JsonProperty("documentGroup")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
public String getDocumentGroup() {
return documentGroup;
}
/**
* Set documentGroup
**/
public void setDocumentGroup(String documentGroup) {
this.documentGroup = documentGroup;
}
public DocumentDtoOutput documentGroup(String documentGroup) {
this.documentGroup = documentGroup;
return this;
}
/**
* Document mimeType
* @return mimeType
**/
@JsonProperty("mimeType")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
public String getMimeType() {
return mimeType;
}
/**
* Set mimeType
**/
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public DocumentDtoOutput mimeType(String mimeType) {
this.mimeType = mimeType;
return this;
}
/**
* map of filenet indexes
* @return filenetIndexes
**/
@JsonProperty("filenetIndexes")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
public Map<String, String> getFilenetIndexes() {
return filenetIndexes;
}
/**
* Set filenetIndexes
**/
public void setFilenetIndexes(Map<String, String> filenetIndexes) {
this.filenetIndexes = filenetIndexes;
}
public DocumentDtoOutput filenetIndexes(Map<String, String> filenetIndexes) {
this.filenetIndexes = filenetIndexes;
return this;
}
public DocumentDtoOutput putFilenetIndexesItem(String key, String filenetIndexesItem) {
if (this.filenetIndexes == null){
filenetIndexes = new HashMap<>();
}
this.filenetIndexes.put(key, filenetIndexesItem);
return this;
}
/**
* map of long term storage indexes
* @return longTermStoragIndex
**/
@JsonProperty("longTermStoragIndex")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
public Map<String, String> getLongTermStoragIndex() {
return longTermStoragIndex;
}
/**
* Set longTermStoragIndex
**/
public void setLongTermStoragIndex(Map<String, String> longTermStoragIndex) {
this.longTermStoragIndex = longTermStoragIndex;
}
public DocumentDtoOutput longTermStoragIndex(Map<String, String> longTermStoragIndex) {
this.longTermStoragIndex = longTermStoragIndex;
return this;
}
public DocumentDtoOutput putLongTermStoragIndexItem(String key, String longTermStoragIndexItem) {
if (this.longTermStoragIndex == null){
longTermStoragIndex = new HashMap<>();
}
this.longTermStoragIndex.put(key, longTermStoragIndexItem);
return this;
}
/**
* Filenet document class
* @return filenetDocumentClass
**/
@JsonProperty("filenetDocumentClass")
public String getFilenetDocumentClass() {
return filenetDocumentClass;
}
/**
* Set filenetDocumentClass
**/
public void setFilenetDocumentClass(String filenetDocumentClass) {
this.filenetDocumentClass = filenetDocumentClass;
}
public DocumentDtoOutput filenetDocumentClass(String filenetDocumentClass) {
this.filenetDocumentClass = filenetDocumentClass;
return this;
}
/**
* Specify if document must be signed
* @return isToSign
**/
@JsonProperty("isToSign")
public Boolean getIsToSign() {
return isToSign;
}
/**
* Set isToSign
**/
public void setIsToSign(Boolean isToSign) {
this.isToSign = isToSign;
}
public DocumentDtoOutput isToSign(Boolean isToSign) {
this.isToSign = isToSign;
return this;
}
/**
* Specify if acknowledgment is mandatory
* @return isMandatory
**/
@JsonProperty("isMandatory")
public Boolean getIsMandatory() {
return isMandatory;
}
/**
* Set isMandatory
**/
public void setIsMandatory(Boolean isMandatory) {
this.isMandatory = isMandatory;
}
public DocumentDtoOutput isMandatory(Boolean isMandatory) {
this.isMandatory = isMandatory;
return this;
}
/**
* presa visione is completed
* @return isBankToSign
**/
@JsonProperty("isBankToSign")
public Boolean getIsBankToSign() {
return isBankToSign;
}
/**
* Set isBankToSign
**/
public void setIsBankToSign(Boolean isBankToSign) {
this.isBankToSign = isBankToSign;
}
public DocumentDtoOutput isBankToSign(Boolean isBankToSign) {
this.isBankToSign = isBankToSign;
return this;
}
/**
* COPIA_CLIENTE or COPIA_BANCA or leave empty(no mandatory field)
* @return copyType
**/
@JsonProperty("copyType")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
public CopyTypeEnum getCopyType() {
return copyType;
}
/**
* Set copyType
**/
public void setCopyType(CopyTypeEnum copyType) {
this.copyType = copyType;
}
public DocumentDtoOutput copyType(CopyTypeEnum copyType) {
this.copyType = copyType;
return this;
}
/**
* File name
* @return fileName
**/
@JsonProperty("fileName")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
public String getFileName() {
return fileName;
}
/**
* Set fileName
**/
public void setFileName(String fileName) {
this.fileName = fileName;
}
public DocumentDtoOutput fileName(String fileName) {
this.fileName = fileName;
return this;
}
/**
* Create a string representation of this pojo.
**/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DocumentDtoOutput {n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("n");
sb.append(" version: ").append(toIndentedString(version)).append("n");
sb.append(" externalId: ").append(toIndentedString(externalId)).append("n");
sb.append(" description: ").append(toIndentedString(description)).append("n");
sb.append(" contentBase64: ").append(toIndentedString(contentBase64)).append("n");
sb.append(" documentGroup: ").append(toIndentedString(documentGroup)).append("n");
sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("n");
sb.append(" filenetIndexes: ").append(toIndentedString(filenetIndexes)).append("n");
sb.append(" longTermStoragIndex: ").append(toIndentedString(longTermStoragIndex)).append("n");
sb.append(" filenetDocumentClass: ").append(toIndentedString(filenetDocumentClass)).append("n");
sb.append(" isToSign: ").append(toIndentedString(isToSign)).append("n");
sb.append(" isMandatory: ").append(toIndentedString(isMandatory)).append("n");
sb.append(" isBankToSign: ").append(toIndentedString(isBankToSign)).append("n");
sb.append(" copyType: ").append(toIndentedString(copyType)).append("n");
sb.append(" fileName: ").append(toIndentedString(fileName)).append("n");
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 ");
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static class DocumentDtoOutputQueryParam {
@jakarta.ws.rs.QueryParam("uuid")
private String uuid;
@jakarta.ws.rs.QueryParam("version")
private Long version = 1l;
@jakarta.ws.rs.QueryParam("externalId")
private String externalId;
@jakarta.ws.rs.QueryParam("description")
private String description;
@jakarta.ws.rs.QueryParam("contentBase64")
private String contentBase64;
@jakarta.ws.rs.QueryParam("documentGroup")
private String documentGroup;
@jakarta.ws.rs.QueryParam("mimeType")
private String mimeType;
@jakarta.ws.rs.QueryParam("filenetIndexes")
private Map<String, String> filenetIndexes = null;
@jakarta.ws.rs.QueryParam("longTermStoragIndex")
private Map<String, String> longTermStoragIndex = null;
@jakarta.ws.rs.QueryParam("filenetDocumentClass")
private String filenetDocumentClass;
@jakarta.ws.rs.QueryParam("isToSign")
private Boolean isToSign;
@jakarta.ws.rs.QueryParam("isMandatory")
private Boolean isMandatory;
@jakarta.ws.rs.QueryParam("isBankToSign")
private Boolean isBankToSign;
public enum CopyTypeEnum {
COPIA_CLIENTE(String.valueOf("COPIA_CLIENTE")), COPIA_BANCA(String.valueOf("COPIA_BANCA")), EMPTY(String.valueOf(""));
// caching enum access
private static final java.util.EnumSet<CopyTypeEnum> values = java.util.EnumSet.allOf(CopyTypeEnum.class);
String value;
CopyTypeEnum (String v) {
value = v;
}
@com.fasterxml.jackson.annotation.JsonValue
public String value() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@com.fasterxml.jackson.annotation.JsonCreator
public static CopyTypeEnum fromString(String v) {
for (CopyTypeEnum b : values) {
if (String.valueOf(b.value).equalsIgnoreCase(v)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + v + "'");
}
}
private CopyTypeEnum copyType;
@jakarta.ws.rs.QueryParam("fileName")
private String fileName;
/**
* Unique identifier 36 chars lenght(UUID)
* @return uuid
**/
@JsonProperty("uuid")
public String getUuid() {
return uuid;
}
/**
* Set uuid
**/
public void setUuid(String uuid) {
this.uuid = uuid;
}
public DocumentDtoOutputQueryParam uuid(String uuid) {
this.uuid = uuid;
return this;
}
/**
* Jpa version for optimistic lock, pass the right value of an existing signer, otherwise pass 1
* @return version
**/
@JsonProperty("version")
public Long getVersion() {
return version;
}
/**
* Set version
**/
public void setVersion(Long version) {
this.version = version;
}
public DocumentDtoOutputQueryParam version(Long version) {
this.version = version;
return this;
}
/**
* Application external id (useful to retrieve document without use the generated id)
* @return externalId
**/
@JsonProperty("externalId")
public String getExternalId() {
return externalId;
}
/**
* Set externalId
**/
public void setExternalId(String externalId) {
this.externalId = externalId;
}
public DocumentDtoOutputQueryParam externalId(String externalId) {
this.externalId = externalId;
return this;
}
/**
* Document description
* @return description
**/
@JsonProperty("description")
public String getDescription() {
return description;
}
/**
* Set description
**/
public void setDescription(String description) {
this.description = description;
}
public DocumentDtoOutputQueryParam description(String description) {
this.description = description;
return this;
}
/**
* File content in base64 string
* @return contentBase64
**/
@JsonProperty("contentBase64")
public String getContentBase64() {
return contentBase64;
}
/**
* Set contentBase64
**/
public void setContentBase64(String contentBase64) {
this.contentBase64 = contentBase64;
}
public DocumentDtoOutputQueryParam contentBase64(String contentBase64) {
this.contentBase64 = contentBase64;
return this;
}
/**
* Document group
* @return documentGroup
**/
@JsonProperty("documentGroup")
public String getDocumentGroup() {
return documentGroup;
}
/**
* Set documentGroup
**/
public void setDocumentGroup(String documentGroup) {
this.documentGroup = documentGroup;
}
public DocumentDtoOutputQueryParam documentGroup(String documentGroup) {
this.documentGroup = documentGroup;
return this;
}
/**
* Document mimeType
* @return mimeType
**/
@JsonProperty("mimeType")
public String getMimeType() {
return mimeType;
}
/**
* Set mimeType
**/
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public DocumentDtoOutputQueryParam mimeType(String mimeType) {
this.mimeType = mimeType;
return this;
}
/**
* map of filenet indexes
* @return filenetIndexes
**/
@JsonProperty("filenetIndexes")
public Map<String, String> getFilenetIndexes() {
return filenetIndexes;
}
/**
* Set filenetIndexes
**/
public void setFilenetIndexes(Map<String, String> filenetIndexes) {
this.filenetIndexes = filenetIndexes;
}
public DocumentDtoOutputQueryParam filenetIndexes(Map<String, String> filenetIndexes) {
this.filenetIndexes = filenetIndexes;
return this;
}
public DocumentDtoOutputQueryParam putFilenetIndexesItem(String key, String filenetIndexesItem) {
this.filenetIndexes.put(key, filenetIndexesItem);
return this;
}
/**
* map of long term storage indexes
* @return longTermStoragIndex
**/
@JsonProperty("longTermStoragIndex")
public Map<String, String> getLongTermStoragIndex() {
return longTermStoragIndex;
}
/**
* Set longTermStoragIndex
**/
public void setLongTermStoragIndex(Map<String, String> longTermStoragIndex) {
this.longTermStoragIndex = longTermStoragIndex;
}
public DocumentDtoOutputQueryParam longTermStoragIndex(Map<String, String> longTermStoragIndex) {
this.longTermStoragIndex = longTermStoragIndex;
return this;
}
public DocumentDtoOutputQueryParam putLongTermStoragIndexItem(String key, String longTermStoragIndexItem) {
this.longTermStoragIndex.put(key, longTermStoragIndexItem);
return this;
}
/**
* Filenet document class
* @return filenetDocumentClass
**/
@JsonProperty("filenetDocumentClass")
public String getFilenetDocumentClass() {
return filenetDocumentClass;
}
/**
* Set filenetDocumentClass
**/
public void setFilenetDocumentClass(String filenetDocumentClass) {
this.filenetDocumentClass = filenetDocumentClass;
}
public DocumentDtoOutputQueryParam filenetDocumentClass(String filenetDocumentClass) {
this.filenetDocumentClass = filenetDocumentClass;
return this;
}
/**
* Specify if document must be signed
* @return isToSign
**/
@JsonProperty("isToSign")
public Boolean getIsToSign() {
return isToSign;
}
/**
* Set isToSign
**/
public void setIsToSign(Boolean isToSign) {
this.isToSign = isToSign;
}
public DocumentDtoOutputQueryParam isToSign(Boolean isToSign) {
this.isToSign = isToSign;
return this;
}
/**
* Specify if acknowledgment is mandatory
* @return isMandatory
**/
@JsonProperty("isMandatory")
public Boolean getIsMandatory() {
return isMandatory;
}
/**
* Set isMandatory
**/
public void setIsMandatory(Boolean isMandatory) {
this.isMandatory = isMandatory;
}
public DocumentDtoOutputQueryParam isMandatory(Boolean isMandatory) {
this.isMandatory = isMandatory;
return this;
}
/**
* presa visione is completed
* @return isBankToSign
**/
@JsonProperty("isBankToSign")
public Boolean getIsBankToSign() {
return isBankToSign;
}
/**
* Set isBankToSign
**/
public void setIsBankToSign(Boolean isBankToSign) {
this.isBankToSign = isBankToSign;
}
public DocumentDtoOutputQueryParam isBankToSign(Boolean isBankToSign) {
this.isBankToSign = isBankToSign;
return this;
}
/**
* COPIA_CLIENTE or COPIA_BANCA or leave empty(no mandatory field)
* @return copyType
**/
@JsonProperty("copyType")
public CopyTypeEnum getCopyType() {
return copyType;
}
/**
* Set copyType
**/
public void setCopyType(CopyTypeEnum copyType) {
this.copyType = copyType;
}
public DocumentDtoOutputQueryParam copyType(CopyTypeEnum copyType) {
this.copyType = copyType;
return this;
}
/**
* File name
* @return fileName
**/
@JsonProperty("fileName")
public String getFileName() {
return fileName;
}
/**
* Set fileName
**/
public void setFileName(String fileName) {
this.fileName = fileName;
}
public DocumentDtoOutputQueryParam fileName(String fileName) {
this.fileName = fileName;
return this;
}
/**
* Create a string representation of this pojo.
**/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DocumentDtoOutputQueryParam {n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("n");
sb.append(" version: ").append(toIndentedString(version)).append("n");
sb.append(" externalId: ").append(toIndentedString(externalId)).append("n");
sb.append(" description: ").append(toIndentedString(description)).append("n");
sb.append(" contentBase64: ").append(toIndentedString(contentBase64)).append("n");
sb.append(" documentGroup: ").append(toIndentedString(documentGroup)).append("n");
sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("n");
sb.append(" filenetIndexes: ").append(toIndentedString(filenetIndexes)).append("n");
sb.append(" longTermStoragIndex: ").append(toIndentedString(longTermStoragIndex)).append("n");
sb.append(" filenetDocumentClass: ").append(toIndentedString(filenetDocumentClass)).append("n");
sb.append(" isToSign: ").append(toIndentedString(isToSign)).append("n");
sb.append(" isMandatory: ").append(toIndentedString(isMandatory)).append("n");
sb.append(" isBankToSign: ").append(toIndentedString(isBankToSign)).append("n");
sb.append(" copyType: ").append(toIndentedString(copyType)).append("n");
sb.append(" fileName: ").append(toIndentedString(fileName)).append("n");
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 ");
}
}
}