From dab2b13df1e2312f180bcd6b12db7b80386fbb26 Mon Sep 17 00:00:00 2001 From: Neil O'Toole Date: Wed, 27 Apr 2016 01:32:02 +0100 Subject: [PATCH] issue #2711 adding equals, hashcode etc to model classes --- .../java/io/swagger/codegen/ClientOpts.java | 29 +++ .../java/io/swagger/codegen/CodegenModel.java | 110 ++++++++++- .../io/swagger/codegen/CodegenOperation.java | 153 +++++++++++++++ .../io/swagger/codegen/CodegenParameter.java | 180 ++++++++++++++++++ .../io/swagger/codegen/CodegenProperty.java | 6 + .../io/swagger/codegen/CodegenResponse.java | 67 +++++++ .../io/swagger/codegen/CodegenSecurity.java | 58 ++++++ .../io/swagger/codegen/SupportingFile.java | 23 +++ 8 files changed, 625 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/ClientOpts.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/ClientOpts.java index 9c4d41f7bfd..1087de5786d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/ClientOpts.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/ClientOpts.java @@ -54,4 +54,33 @@ public class ClientOpts { sb.append("}"); return sb.toString(); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ClientOpts that = (ClientOpts) o; + + if (uri != null ? !uri.equals(that.uri) : that.uri != null) + return false; + if (target != null ? !target.equals(that.target) : that.target != null) + return false; + if (auth != null ? !auth.equals(that.auth) : that.auth != null) + return false; + if (properties != null ? !properties.equals(that.properties) : that.properties != null) + return false; + return outputDirectory != null ? outputDirectory.equals(that.outputDirectory) : that.outputDirectory == null; + + } + + @Override + public int hashCode() { + int result = uri != null ? uri.hashCode() : 0; + result = 31 * result + (target != null ? target.hashCode() : 0); + result = 31 * result + (auth != null ? auth.hashCode() : 0); + result = 31 * result + (properties != null ? properties.hashCode() : 0); + result = 31 * result + (outputDirectory != null ? outputDirectory.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java index 62f5e27aa05..945388b2588 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java @@ -1,7 +1,6 @@ package io.swagger.codegen; import io.swagger.models.ExternalDocs; - import java.util.*; public class CodegenModel { @@ -39,4 +38,113 @@ public class CodegenModel { allVars = vars; allMandatory = mandatory; } + + @Override + public String toString() { + return String.format("%s(%s)", name, classname); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenModel that = (CodegenModel) o; + + if (parent != null ? !parent.equals(that.parent) : that.parent != null) + return false; + if (parentSchema != null ? !parentSchema.equals(that.parentSchema) : that.parentSchema != null) + return false; + if (interfaces != null ? !interfaces.equals(that.interfaces) : that.interfaces != null) + return false; + if (parentModel != null ? !parentModel.equals(that.parentModel) : that.parentModel != null) + return false; + if (interfaceModels != null ? !interfaceModels.equals(that.interfaceModels) : that.interfaceModels != null) + return false; + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (classname != null ? !classname.equals(that.classname) : that.classname != null) + return false; + if (description != null ? !description.equals(that.description) : that.description != null) + return false; + if (classVarName != null ? !classVarName.equals(that.classVarName) : that.classVarName != null) + return false; + if (modelJson != null ? !modelJson.equals(that.modelJson) : that.modelJson != null) + return false; + if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != null) + return false; + if (classFilename != null ? !classFilename.equals(that.classFilename) : that.classFilename != null) + return false; + if (unescapedDescription != null ? !unescapedDescription.equals(that.unescapedDescription) : that.unescapedDescription != null) + return false; + if (discriminator != null ? !discriminator.equals(that.discriminator) : that.discriminator != null) + return false; + if (defaultValue != null ? !defaultValue.equals(that.defaultValue) : that.defaultValue != null) + return false; + if (vars != null ? !vars.equals(that.vars) : that.vars != null) + return false; + if (requiredVars != null ? !requiredVars.equals(that.requiredVars) : that.requiredVars != null) + return false; + if (optionalVars != null ? !optionalVars.equals(that.optionalVars) : that.optionalVars != null) + return false; + if (allVars != null ? !allVars.equals(that.allVars) : that.allVars != null) + return false; + if (allowableValues != null ? !allowableValues.equals(that.allowableValues) : that.allowableValues != null) + return false; + if (mandatory != null ? !mandatory.equals(that.mandatory) : that.mandatory != null) + return false; + if (allMandatory != null ? !allMandatory.equals(that.allMandatory) : that.allMandatory != null) + return false; + if (imports != null ? !imports.equals(that.imports) : that.imports != null) + return false; + if (hasVars != null ? !hasVars.equals(that.hasVars) : that.hasVars != null) + return false; + if (emptyVars != null ? !emptyVars.equals(that.emptyVars) : that.emptyVars != null) + return false; + if (hasMoreModels != null ? !hasMoreModels.equals(that.hasMoreModels) : that.hasMoreModels != null) + return false; + if (hasEnums != null ? !hasEnums.equals(that.hasEnums) : that.hasEnums != null) + return false; + if (isEnum != null ? !isEnum.equals(that.isEnum) : that.isEnum != null) + return false; + if (externalDocs != null ? !externalDocs.equals(that.externalDocs) : that.externalDocs != null) + return false; + return vendorExtensions != null ? vendorExtensions.equals(that.vendorExtensions) : that.vendorExtensions == null; + + } + + @Override + public int hashCode() { + int result = parent != null ? parent.hashCode() : 0; + result = 31 * result + (parentSchema != null ? parentSchema.hashCode() : 0); + result = 31 * result + (interfaces != null ? interfaces.hashCode() : 0); + result = 31 * result + (parentModel != null ? parentModel.hashCode() : 0); + result = 31 * result + (interfaceModels != null ? interfaceModels.hashCode() : 0); + result = 31 * result + (name != null ? name.hashCode() : 0); + result = 31 * result + (classname != null ? classname.hashCode() : 0); + result = 31 * result + (description != null ? description.hashCode() : 0); + result = 31 * result + (classVarName != null ? classVarName.hashCode() : 0); + result = 31 * result + (modelJson != null ? modelJson.hashCode() : 0); + result = 31 * result + (dataType != null ? dataType.hashCode() : 0); + result = 31 * result + (classFilename != null ? classFilename.hashCode() : 0); + result = 31 * result + (unescapedDescription != null ? unescapedDescription.hashCode() : 0); + result = 31 * result + (discriminator != null ? discriminator.hashCode() : 0); + result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0); + result = 31 * result + (vars != null ? vars.hashCode() : 0); + result = 31 * result + (requiredVars != null ? requiredVars.hashCode() : 0); + result = 31 * result + (optionalVars != null ? optionalVars.hashCode() : 0); + result = 31 * result + (allVars != null ? allVars.hashCode() : 0); + result = 31 * result + (allowableValues != null ? allowableValues.hashCode() : 0); + result = 31 * result + (mandatory != null ? mandatory.hashCode() : 0); + result = 31 * result + (allMandatory != null ? allMandatory.hashCode() : 0); + result = 31 * result + (imports != null ? imports.hashCode() : 0); + result = 31 * result + (hasVars != null ? hasVars.hashCode() : 0); + result = 31 * result + (emptyVars != null ? emptyVars.hashCode() : 0); + result = 31 * result + (hasMoreModels != null ? hasMoreModels.hashCode() : 0); + result = 31 * result + (hasEnums != null ? hasEnums.hashCode() : 0); + result = 31 * result + (isEnum != null ? isEnum.hashCode() : 0); + result = 31 * result + (externalDocs != null ? externalDocs.hashCode() : 0); + result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java index 2485e657de2..48858a0d504 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java @@ -88,4 +88,157 @@ public class CodegenOperation { return nonempty(formParams); } + @Override + public String toString() { + return String.format("%s(%s)", baseName, path); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenOperation that = (CodegenOperation) o; + + if (responseHeaders != null ? !responseHeaders.equals(that.responseHeaders) : that.responseHeaders != null) + return false; + if (hasAuthMethods != null ? !hasAuthMethods.equals(that.hasAuthMethods) : that.hasAuthMethods != null) + return false; + if (hasConsumes != null ? !hasConsumes.equals(that.hasConsumes) : that.hasConsumes != null) + return false; + if (hasProduces != null ? !hasProduces.equals(that.hasProduces) : that.hasProduces != null) + return false; + if (hasParams != null ? !hasParams.equals(that.hasParams) : that.hasParams != null) + return false; + if (hasOptionalParams != null ? !hasOptionalParams.equals(that.hasOptionalParams) : that.hasOptionalParams != null) + return false; + if (returnTypeIsPrimitive != null ? !returnTypeIsPrimitive.equals(that.returnTypeIsPrimitive) : that.returnTypeIsPrimitive != null) + return false; + if (returnSimpleType != null ? !returnSimpleType.equals(that.returnSimpleType) : that.returnSimpleType != null) + return false; + if (subresourceOperation != null ? !subresourceOperation.equals(that.subresourceOperation) : that.subresourceOperation != null) + return false; + if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null) + return false; + if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null) + return false; + if (isMultipart != null ? !isMultipart.equals(that.isMultipart) : that.isMultipart != null) + return false; + if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null) + return false; + if (isResponseBinary != null ? !isResponseBinary.equals(that.isResponseBinary) : that.isResponseBinary != null) + return false; + if (hasReference != null ? !hasReference.equals(that.hasReference) : that.hasReference != null) + return false; + if (path != null ? !path.equals(that.path) : that.path != null) + return false; + if (operationId != null ? !operationId.equals(that.operationId) : that.operationId != null) + return false; + if (returnType != null ? !returnType.equals(that.returnType) : that.returnType != null) + return false; + if (httpMethod != null ? !httpMethod.equals(that.httpMethod) : that.httpMethod != null) + return false; + if (returnBaseType != null ? !returnBaseType.equals(that.returnBaseType) : that.returnBaseType != null) + return false; + if (returnContainer != null ? !returnContainer.equals(that.returnContainer) : that.returnContainer != null) + return false; + if (summary != null ? !summary.equals(that.summary) : that.summary != null) + return false; + if (unescapedNotes != null ? !unescapedNotes.equals(that.unescapedNotes) : that.unescapedNotes != null) + return false; + if (notes != null ? !notes.equals(that.notes) : that.notes != null) + return false; + if (baseName != null ? !baseName.equals(that.baseName) : that.baseName != null) + return false; + if (defaultResponse != null ? !defaultResponse.equals(that.defaultResponse) : that.defaultResponse != null) + return false; + if (discriminator != null ? !discriminator.equals(that.discriminator) : that.discriminator != null) + return false; + if (consumes != null ? !consumes.equals(that.consumes) : that.consumes != null) + return false; + if (produces != null ? !produces.equals(that.produces) : that.produces != null) + return false; + if (bodyParam != null ? !bodyParam.equals(that.bodyParam) : that.bodyParam != null) + return false; + if (allParams != null ? !allParams.equals(that.allParams) : that.allParams != null) + return false; + if (bodyParams != null ? !bodyParams.equals(that.bodyParams) : that.bodyParams != null) + return false; + if (pathParams != null ? !pathParams.equals(that.pathParams) : that.pathParams != null) + return false; + if (queryParams != null ? !queryParams.equals(that.queryParams) : that.queryParams != null) + return false; + if (headerParams != null ? !headerParams.equals(that.headerParams) : that.headerParams != null) + return false; + if (formParams != null ? !formParams.equals(that.formParams) : that.formParams != null) + return false; + if (authMethods != null ? !authMethods.equals(that.authMethods) : that.authMethods != null) + return false; + if (tags != null ? !tags.equals(that.tags) : that.tags != null) + return false; + if (responses != null ? !responses.equals(that.responses) : that.responses != null) + return false; + if (imports != null ? !imports.equals(that.imports) : that.imports != null) + return false; + if (examples != null ? !examples.equals(that.examples) : that.examples != null) + return false; + if (externalDocs != null ? !externalDocs.equals(that.externalDocs) : that.externalDocs != null) + return false; + if (vendorExtensions != null ? !vendorExtensions.equals(that.vendorExtensions) : that.vendorExtensions != null) + return false; + if (nickname != null ? !nickname.equals(that.nickname) : that.nickname != null) + return false; + return operationIdLowerCase != null ? operationIdLowerCase.equals(that.operationIdLowerCase) : that.operationIdLowerCase == null; + + } + + @Override + public int hashCode() { + int result = responseHeaders != null ? responseHeaders.hashCode() : 0; + result = 31 * result + (hasAuthMethods != null ? hasAuthMethods.hashCode() : 0); + result = 31 * result + (hasConsumes != null ? hasConsumes.hashCode() : 0); + result = 31 * result + (hasProduces != null ? hasProduces.hashCode() : 0); + result = 31 * result + (hasParams != null ? hasParams.hashCode() : 0); + result = 31 * result + (hasOptionalParams != null ? hasOptionalParams.hashCode() : 0); + result = 31 * result + (returnTypeIsPrimitive != null ? returnTypeIsPrimitive.hashCode() : 0); + result = 31 * result + (returnSimpleType != null ? returnSimpleType.hashCode() : 0); + result = 31 * result + (subresourceOperation != null ? subresourceOperation.hashCode() : 0); + result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0); + result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0); + result = 31 * result + (isMultipart != null ? isMultipart.hashCode() : 0); + result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0); + result = 31 * result + (isResponseBinary != null ? isResponseBinary.hashCode() : 0); + result = 31 * result + (hasReference != null ? hasReference.hashCode() : 0); + result = 31 * result + (path != null ? path.hashCode() : 0); + result = 31 * result + (operationId != null ? operationId.hashCode() : 0); + result = 31 * result + (returnType != null ? returnType.hashCode() : 0); + result = 31 * result + (httpMethod != null ? httpMethod.hashCode() : 0); + result = 31 * result + (returnBaseType != null ? returnBaseType.hashCode() : 0); + result = 31 * result + (returnContainer != null ? returnContainer.hashCode() : 0); + result = 31 * result + (summary != null ? summary.hashCode() : 0); + result = 31 * result + (unescapedNotes != null ? unescapedNotes.hashCode() : 0); + result = 31 * result + (notes != null ? notes.hashCode() : 0); + result = 31 * result + (baseName != null ? baseName.hashCode() : 0); + result = 31 * result + (defaultResponse != null ? defaultResponse.hashCode() : 0); + result = 31 * result + (discriminator != null ? discriminator.hashCode() : 0); + result = 31 * result + (consumes != null ? consumes.hashCode() : 0); + result = 31 * result + (produces != null ? produces.hashCode() : 0); + result = 31 * result + (bodyParam != null ? bodyParam.hashCode() : 0); + result = 31 * result + (allParams != null ? allParams.hashCode() : 0); + result = 31 * result + (bodyParams != null ? bodyParams.hashCode() : 0); + result = 31 * result + (pathParams != null ? pathParams.hashCode() : 0); + result = 31 * result + (queryParams != null ? queryParams.hashCode() : 0); + result = 31 * result + (headerParams != null ? headerParams.hashCode() : 0); + result = 31 * result + (formParams != null ? formParams.hashCode() : 0); + result = 31 * result + (authMethods != null ? authMethods.hashCode() : 0); + result = 31 * result + (tags != null ? tags.hashCode() : 0); + result = 31 * result + (responses != null ? responses.hashCode() : 0); + result = 31 * result + (imports != null ? imports.hashCode() : 0); + result = 31 * result + (examples != null ? examples.hashCode() : 0); + result = 31 * result + (externalDocs != null ? externalDocs.hashCode() : 0); + result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0); + result = 31 * result + (nickname != null ? nickname.hashCode() : 0); + result = 31 * result + (operationIdLowerCase != null ? operationIdLowerCase.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java index 3f38d391e70..a69f7197181 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java @@ -137,5 +137,185 @@ public class CodegenParameter { return output; } + + @Override + public String toString() { + return String.format("%s(%s)", baseName, dataType); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenParameter that = (CodegenParameter) o; + + if (isEnum != that.isEnum) return false; + if (isFormParam != null ? !isFormParam.equals(that.isFormParam) : that.isFormParam != null) + return false; + if (isQueryParam != null ? !isQueryParam.equals(that.isQueryParam) : that.isQueryParam != null) + return false; + if (isPathParam != null ? !isPathParam.equals(that.isPathParam) : that.isPathParam != null) + return false; + if (isHeaderParam != null ? !isHeaderParam.equals(that.isHeaderParam) : that.isHeaderParam != null) + return false; + if (isCookieParam != null ? !isCookieParam.equals(that.isCookieParam) : that.isCookieParam != null) + return false; + if (isBodyParam != null ? !isBodyParam.equals(that.isBodyParam) : that.isBodyParam != null) + return false; + if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null) + return false; + if (isContainer != null ? !isContainer.equals(that.isContainer) : that.isContainer != null) + return false; + if (secondaryParam != null ? !secondaryParam.equals(that.secondaryParam) : that.secondaryParam != null) + return false; + if (isCollectionFormatMulti != null ? !isCollectionFormatMulti.equals(that.isCollectionFormatMulti) : that.isCollectionFormatMulti != null) + return false; + if (isPrimitiveType != null ? !isPrimitiveType.equals(that.isPrimitiveType) : that.isPrimitiveType != null) + return false; + if (baseName != null ? !baseName.equals(that.baseName) : that.baseName != null) + return false; + if (paramName != null ? !paramName.equals(that.paramName) : that.paramName != null) + return false; + if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != null) + return false; + if (datatypeWithEnum != null ? !datatypeWithEnum.equals(that.datatypeWithEnum) : that.datatypeWithEnum != null) + return false; + if (collectionFormat != null ? !collectionFormat.equals(that.collectionFormat) : that.collectionFormat != null) + return false; + if (description != null ? !description.equals(that.description) : that.description != null) + return false; + if (unescapedDescription != null ? !unescapedDescription.equals(that.unescapedDescription) : that.unescapedDescription != null) + return false; + if (baseType != null ? !baseType.equals(that.baseType) : that.baseType != null) + return false; + if (defaultValue != null ? !defaultValue.equals(that.defaultValue) : that.defaultValue != null) + return false; + if (example != null ? !example.equals(that.example) : that.example != null) + return false; + if (jsonSchema != null ? !jsonSchema.equals(that.jsonSchema) : that.jsonSchema != null) + return false; + if (isString != null ? !isString.equals(that.isString) : that.isString != null) + return false; + if (isInteger != null ? !isInteger.equals(that.isInteger) : that.isInteger != null) + return false; + if (isLong != null ? !isLong.equals(that.isLong) : that.isLong != null) + return false; + if (isFloat != null ? !isFloat.equals(that.isFloat) : that.isFloat != null) + return false; + if (isDouble != null ? !isDouble.equals(that.isDouble) : that.isDouble != null) + return false; + if (isByteArray != null ? !isByteArray.equals(that.isByteArray) : that.isByteArray != null) + return false; + if (isBinary != null ? !isBinary.equals(that.isBinary) : that.isBinary != null) + return false; + if (isBoolean != null ? !isBoolean.equals(that.isBoolean) : that.isBoolean != null) + return false; + if (isDate != null ? !isDate.equals(that.isDate) : that.isDate != null) + return false; + if (isDateTime != null ? !isDateTime.equals(that.isDateTime) : that.isDateTime != null) + return false; + if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null) + return false; + if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null) + return false; + if (isFile != null ? !isFile.equals(that.isFile) : that.isFile != null) + return false; + if (notFile != null ? !notFile.equals(that.notFile) : that.notFile != null) + return false; + if (_enum != null ? !_enum.equals(that._enum) : that._enum != null) + return false; + if (allowableValues != null ? !allowableValues.equals(that.allowableValues) : that.allowableValues != null) + return false; + if (items != null ? !items.equals(that.items) : that.items != null) + return false; + if (vendorExtensions != null ? !vendorExtensions.equals(that.vendorExtensions) : that.vendorExtensions != null) + return false; + if (hasValidation != null ? !hasValidation.equals(that.hasValidation) : that.hasValidation != null) + return false; + if (required != null ? !required.equals(that.required) : that.required != null) + return false; + if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null) + return false; + if (exclusiveMaximum != null ? !exclusiveMaximum.equals(that.exclusiveMaximum) : that.exclusiveMaximum != null) + return false; + if (minimum != null ? !minimum.equals(that.minimum) : that.minimum != null) + return false; + if (exclusiveMinimum != null ? !exclusiveMinimum.equals(that.exclusiveMinimum) : that.exclusiveMinimum != null) + return false; + if (maxLength != null ? !maxLength.equals(that.maxLength) : that.maxLength != null) + return false; + if (minLength != null ? !minLength.equals(that.minLength) : that.minLength != null) + return false; + if (pattern != null ? !pattern.equals(that.pattern) : that.pattern != null) + return false; + if (maxItems != null ? !maxItems.equals(that.maxItems) : that.maxItems != null) + return false; + if (minItems != null ? !minItems.equals(that.minItems) : that.minItems != null) + return false; + if (uniqueItems != null ? !uniqueItems.equals(that.uniqueItems) : that.uniqueItems != null) + return false; + return multipleOf != null ? multipleOf.equals(that.multipleOf) : that.multipleOf == null; + + } + + @Override + public int hashCode() { + int result = isFormParam != null ? isFormParam.hashCode() : 0; + result = 31 * result + (isQueryParam != null ? isQueryParam.hashCode() : 0); + result = 31 * result + (isPathParam != null ? isPathParam.hashCode() : 0); + result = 31 * result + (isHeaderParam != null ? isHeaderParam.hashCode() : 0); + result = 31 * result + (isCookieParam != null ? isCookieParam.hashCode() : 0); + result = 31 * result + (isBodyParam != null ? isBodyParam.hashCode() : 0); + result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0); + result = 31 * result + (isContainer != null ? isContainer.hashCode() : 0); + result = 31 * result + (secondaryParam != null ? secondaryParam.hashCode() : 0); + result = 31 * result + (isCollectionFormatMulti != null ? isCollectionFormatMulti.hashCode() : 0); + result = 31 * result + (isPrimitiveType != null ? isPrimitiveType.hashCode() : 0); + result = 31 * result + (baseName != null ? baseName.hashCode() : 0); + result = 31 * result + (paramName != null ? paramName.hashCode() : 0); + result = 31 * result + (dataType != null ? dataType.hashCode() : 0); + result = 31 * result + (datatypeWithEnum != null ? datatypeWithEnum.hashCode() : 0); + result = 31 * result + (collectionFormat != null ? collectionFormat.hashCode() : 0); + result = 31 * result + (description != null ? description.hashCode() : 0); + result = 31 * result + (unescapedDescription != null ? unescapedDescription.hashCode() : 0); + result = 31 * result + (baseType != null ? baseType.hashCode() : 0); + result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0); + result = 31 * result + (example != null ? example.hashCode() : 0); + result = 31 * result + (jsonSchema != null ? jsonSchema.hashCode() : 0); + result = 31 * result + (isString != null ? isString.hashCode() : 0); + result = 31 * result + (isInteger != null ? isInteger.hashCode() : 0); + result = 31 * result + (isLong != null ? isLong.hashCode() : 0); + result = 31 * result + (isFloat != null ? isFloat.hashCode() : 0); + result = 31 * result + (isDouble != null ? isDouble.hashCode() : 0); + result = 31 * result + (isByteArray != null ? isByteArray.hashCode() : 0); + result = 31 * result + (isBinary != null ? isBinary.hashCode() : 0); + result = 31 * result + (isBoolean != null ? isBoolean.hashCode() : 0); + result = 31 * result + (isDate != null ? isDate.hashCode() : 0); + result = 31 * result + (isDateTime != null ? isDateTime.hashCode() : 0); + result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0); + result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0); + result = 31 * result + (isFile != null ? isFile.hashCode() : 0); + result = 31 * result + (notFile != null ? notFile.hashCode() : 0); + result = 31 * result + (isEnum ? 1 : 0); + result = 31 * result + (_enum != null ? _enum.hashCode() : 0); + result = 31 * result + (allowableValues != null ? allowableValues.hashCode() : 0); + result = 31 * result + (items != null ? items.hashCode() : 0); + result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0); + result = 31 * result + (hasValidation != null ? hasValidation.hashCode() : 0); + result = 31 * result + (required != null ? required.hashCode() : 0); + result = 31 * result + (maximum != null ? maximum.hashCode() : 0); + result = 31 * result + (exclusiveMaximum != null ? exclusiveMaximum.hashCode() : 0); + result = 31 * result + (minimum != null ? minimum.hashCode() : 0); + result = 31 * result + (exclusiveMinimum != null ? exclusiveMinimum.hashCode() : 0); + result = 31 * result + (maxLength != null ? maxLength.hashCode() : 0); + result = 31 * result + (minLength != null ? minLength.hashCode() : 0); + result = 31 * result + (pattern != null ? pattern.hashCode() : 0); + result = 31 * result + (maxItems != null ? maxItems.hashCode() : 0); + result = 31 * result + (minItems != null ? minItems.hashCode() : 0); + result = 31 * result + (uniqueItems != null ? uniqueItems.hashCode() : 0); + result = 31 * result + (multipleOf != null ? multipleOf.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java index 79b7c60a9eb..d58a1a81b1d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java @@ -44,6 +44,12 @@ public class CodegenProperty { public Map vendorExtensions; public Boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template) + @Override + public String toString() { + return String.format("%s(%s)", baseName, datatype); + } + + @Override public int hashCode() { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenResponse.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenResponse.java index e20735b1418..746f65cea38 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenResponse.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenResponse.java @@ -22,4 +22,71 @@ public class CodegenResponse { public boolean isWildcard() { return "0".equals(code) || "default".equals(code); } + + @Override + public String toString() { + return String.format("%s(%s)", code, containerType); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenResponse that = (CodegenResponse) o; + + if (headers != null ? !headers.equals(that.headers) : that.headers != null) + return false; + if (code != null ? !code.equals(that.code) : that.code != null) + return false; + if (message != null ? !message.equals(that.message) : that.message != null) + return false; + if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null) + return false; + if (examples != null ? !examples.equals(that.examples) : that.examples != null) + return false; + if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != null) + return false; + if (baseType != null ? !baseType.equals(that.baseType) : that.baseType != null) + return false; + if (containerType != null ? !containerType.equals(that.containerType) : that.containerType != null) + return false; + if (isDefault != null ? !isDefault.equals(that.isDefault) : that.isDefault != null) + return false; + if (simpleType != null ? !simpleType.equals(that.simpleType) : that.simpleType != null) + return false; + if (primitiveType != null ? !primitiveType.equals(that.primitiveType) : that.primitiveType != null) + return false; + if (isMapContainer != null ? !isMapContainer.equals(that.isMapContainer) : that.isMapContainer != null) + return false; + if (isListContainer != null ? !isListContainer.equals(that.isListContainer) : that.isListContainer != null) + return false; + if (isBinary != null ? !isBinary.equals(that.isBinary) : that.isBinary != null) + return false; + if (schema != null ? !schema.equals(that.schema) : that.schema != null) + return false; + return jsonSchema != null ? jsonSchema.equals(that.jsonSchema) : that.jsonSchema == null; + + } + + @Override + public int hashCode() { + int result = headers != null ? headers.hashCode() : 0; + result = 31 * result + (code != null ? code.hashCode() : 0); + result = 31 * result + (message != null ? message.hashCode() : 0); + result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0); + result = 31 * result + (examples != null ? examples.hashCode() : 0); + result = 31 * result + (dataType != null ? dataType.hashCode() : 0); + result = 31 * result + (baseType != null ? baseType.hashCode() : 0); + result = 31 * result + (containerType != null ? containerType.hashCode() : 0); + result = 31 * result + (isDefault != null ? isDefault.hashCode() : 0); + result = 31 * result + (simpleType != null ? simpleType.hashCode() : 0); + result = 31 * result + (primitiveType != null ? primitiveType.hashCode() : 0); + result = 31 * result + (isMapContainer != null ? isMapContainer.hashCode() : 0); + result = 31 * result + (isListContainer != null ? isListContainer.hashCode() : 0); + result = 31 * result + (isBinary != null ? isBinary.hashCode() : 0); + result = 31 * result + (schema != null ? schema.hashCode() : 0); + result = 31 * result + (jsonSchema != null ? jsonSchema.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenSecurity.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenSecurity.java index 10118206383..2e33242c370 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenSecurity.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenSecurity.java @@ -13,4 +13,62 @@ public class CodegenSecurity { // Oauth specific public String flow, authorizationUrl, tokenUrl; public List> scopes; + + @Override + public String toString() { + return String.format("%s(%s)", name, type); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenSecurity that = (CodegenSecurity) o; + + if (name != null ? !name.equals(that.name) : that.name != null) + return false; + if (type != null ? !type.equals(that.type) : that.type != null) + return false; + if (hasMore != null ? !hasMore.equals(that.hasMore) : that.hasMore != null) + return false; + if (isBasic != null ? !isBasic.equals(that.isBasic) : that.isBasic != null) + return false; + if (isOAuth != null ? !isOAuth.equals(that.isOAuth) : that.isOAuth != null) + return false; + if (isApiKey != null ? !isApiKey.equals(that.isApiKey) : that.isApiKey != null) + return false; + if (keyParamName != null ? !keyParamName.equals(that.keyParamName) : that.keyParamName != null) + return false; + if (isKeyInQuery != null ? !isKeyInQuery.equals(that.isKeyInQuery) : that.isKeyInQuery != null) + return false; + if (isKeyInHeader != null ? !isKeyInHeader.equals(that.isKeyInHeader) : that.isKeyInHeader != null) + return false; + if (flow != null ? !flow.equals(that.flow) : that.flow != null) + return false; + if (authorizationUrl != null ? !authorizationUrl.equals(that.authorizationUrl) : that.authorizationUrl != null) + return false; + if (tokenUrl != null ? !tokenUrl.equals(that.tokenUrl) : that.tokenUrl != null) + return false; + return scopes != null ? scopes.equals(that.scopes) : that.scopes == null; + + } + + @Override + public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (type != null ? type.hashCode() : 0); + result = 31 * result + (hasMore != null ? hasMore.hashCode() : 0); + result = 31 * result + (isBasic != null ? isBasic.hashCode() : 0); + result = 31 * result + (isOAuth != null ? isOAuth.hashCode() : 0); + result = 31 * result + (isApiKey != null ? isApiKey.hashCode() : 0); + result = 31 * result + (keyParamName != null ? keyParamName.hashCode() : 0); + result = 31 * result + (isKeyInQuery != null ? isKeyInQuery.hashCode() : 0); + result = 31 * result + (isKeyInHeader != null ? isKeyInHeader.hashCode() : 0); + result = 31 * result + (flow != null ? flow.hashCode() : 0); + result = 31 * result + (authorizationUrl != null ? authorizationUrl.hashCode() : 0); + result = 31 * result + (tokenUrl != null ? tokenUrl.hashCode() : 0); + result = 31 * result + (scopes != null ? scopes.hashCode() : 0); + return result; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/SupportingFile.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/SupportingFile.java index 976376bae68..e5fb6a27da6 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/SupportingFile.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/SupportingFile.java @@ -21,4 +21,27 @@ public class SupportingFile { return builder.toString(); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + SupportingFile that = (SupportingFile) o; + + if (templateFile != null ? !templateFile.equals(that.templateFile) : that.templateFile != null) + return false; + if (folder != null ? !folder.equals(that.folder) : that.folder != null) + return false; + return destinationFilename != null ? destinationFilename.equals(that.destinationFilename) : that.destinationFilename == null; + + } + + @Override + public int hashCode() { + int result = templateFile != null ? templateFile.hashCode() : 0; + result = 31 * result + (folder != null ? folder.hashCode() : 0); + result = 31 * result + (destinationFilename != null ? destinationFilename.hashCode() : 0); + return result; + } } \ No newline at end of file