Skip to content

Issue 239: Added default IntelliJ equals, hashCode and toString methods. #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -663,64 +663,65 @@ public void setIsBase64Encoded(boolean isBase64Encoded) {
}

@Override
public int hashCode() {
int hash = 7;

hash = 43 * hash + Objects.hashCode(this.requestContext);
hash = 43 * hash + Objects.hashCode(this.body);
hash = 43 * hash + (this.isBase64Encoded ? 1 : 0);

return hash;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}

if (obj == null) {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

APIGatewayV2WebSocketEvent that = (APIGatewayV2WebSocketEvent) o;

if (isBase64Encoded != that.isBase64Encoded) return false;
if (resource != null ? !resource.equals(that.resource) : that.resource != null) return false;
if (path != null ? !path.equals(that.path) : that.path != null) return false;
if (httpMethod != null ? !httpMethod.equals(that.httpMethod) : that.httpMethod != null) return false;
if (headers != null ? !headers.equals(that.headers) : that.headers != null) return false;
if (multiValueHeaders != null ? !multiValueHeaders.equals(that.multiValueHeaders) : that.multiValueHeaders != null)
return false;
}

if (getClass() != obj.getClass()) {
if (queryStringParameters != null ? !queryStringParameters.equals(that.queryStringParameters) : that.queryStringParameters != null)
return false;
}

final APIGatewayV2WebSocketEvent other = (APIGatewayV2WebSocketEvent) obj;

if (this.isBase64Encoded != other.isBase64Encoded) {
if (multiValueQueryStringParameters != null ? !multiValueQueryStringParameters.equals(that.multiValueQueryStringParameters) : that.multiValueQueryStringParameters != null)
return false;
}

if (!Objects.equals(this.body, other.body)) {
if (pathParameters != null ? !pathParameters.equals(that.pathParameters) : that.pathParameters != null)
return false;
}

if (!Objects.equals(this.requestContext, other.requestContext)) {
if (stageVariables != null ? !stageVariables.equals(that.stageVariables) : that.stageVariables != null)
return false;
}
return true;
if (requestContext != null ? !requestContext.equals(that.requestContext) : that.requestContext != null)
return false;
return body != null ? body.equals(that.body) : that.body == null;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");

if (requestContext != null) {
sb.append("requestContext: ").append(requestContext).append(",");
}

if (body != null) {
sb.append("body: ").append(body).append(",");
}

sb.append("isBase64Encoded: ").append(isBase64Encoded).append(",");

sb.append("}");
public int hashCode() {
int result = resource != null ? resource.hashCode() : 0;
result = 31 * result + (path != null ? path.hashCode() : 0);
result = 31 * result + (httpMethod != null ? httpMethod.hashCode() : 0);
result = 31 * result + (headers != null ? headers.hashCode() : 0);
result = 31 * result + (multiValueHeaders != null ? multiValueHeaders.hashCode() : 0);
result = 31 * result + (queryStringParameters != null ? queryStringParameters.hashCode() : 0);
result = 31 * result + (multiValueQueryStringParameters != null ? multiValueQueryStringParameters.hashCode() : 0);
result = 31 * result + (pathParameters != null ? pathParameters.hashCode() : 0);
result = 31 * result + (stageVariables != null ? stageVariables.hashCode() : 0);
result = 31 * result + (requestContext != null ? requestContext.hashCode() : 0);
result = 31 * result + (body != null ? body.hashCode() : 0);
result = 31 * result + (isBase64Encoded ? 1 : 0);
return result;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("APIGatewayV2WebSocketEvent{");
sb.append("resource='").append(resource).append('\'');
sb.append(", path='").append(path).append('\'');
sb.append(", httpMethod='").append(httpMethod).append('\'');
sb.append(", headers=").append(headers);
sb.append(", multiValueHeaders=").append(multiValueHeaders);
sb.append(", queryStringParameters=").append(queryStringParameters);
sb.append(", multiValueQueryStringParameters=").append(multiValueQueryStringParameters);
sb.append(", pathParameters=").append(pathParameters);
sb.append(", stageVariables=").append(stageVariables);
sb.append(", requestContext=").append(requestContext);
sb.append(", body='").append(body).append('\'');
sb.append(", isBase64Encoded=").append(isBase64Encoded);
sb.append('}');
return sb.toString();
}

}