/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("Method").add("HttpMethod", httpMethod()).add("AuthorizationType", authorizationType()) .add("AuthorizerId", authorizerId()).add("ApiKeyRequired", apiKeyRequired()) .add("RequestValidatorId", requestValidatorId()).add("OperationName", operationName()) .add("RequestParameters", requestParameters()).add("RequestModels", requestModels()) .add("MethodResponses", methodResponses()).add("MethodIntegration", methodIntegration()) .add("AuthorizationScopes", authorizationScopes()).build(); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(httpMethod()); hashCode = 31 * hashCode + Objects.hashCode(authorizationType()); hashCode = 31 * hashCode + Objects.hashCode(authorizerId()); hashCode = 31 * hashCode + Objects.hashCode(apiKeyRequired()); hashCode = 31 * hashCode + Objects.hashCode(requestValidatorId()); hashCode = 31 * hashCode + Objects.hashCode(operationName()); hashCode = 31 * hashCode + Objects.hashCode(requestParameters()); hashCode = 31 * hashCode + Objects.hashCode(requestModels()); hashCode = 31 * hashCode + Objects.hashCode(methodResponses()); hashCode = 31 * hashCode + Objects.hashCode(methodIntegration()); hashCode = 31 * hashCode + Objects.hashCode(authorizationScopes()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "httpMethod": return Optional.ofNullable(clazz.cast(httpMethod())); case "authorizationType": return Optional.ofNullable(clazz.cast(authorizationType())); case "authorizerId": return Optional.ofNullable(clazz.cast(authorizerId())); case "apiKeyRequired": return Optional.ofNullable(clazz.cast(apiKeyRequired())); case "requestValidatorId": return Optional.ofNullable(clazz.cast(requestValidatorId())); case "operationName": return Optional.ofNullable(clazz.cast(operationName())); case "requestParameters": return Optional.ofNullable(clazz.cast(requestParameters())); case "requestModels": return Optional.ofNullable(clazz.cast(requestModels())); case "methodResponses": return Optional.ofNullable(clazz.cast(methodResponses())); case "methodIntegration": return Optional.ofNullable(clazz.cast(methodIntegration())); case "authorizationScopes": return Optional.ofNullable(clazz.cast(authorizationScopes())); default: return Optional.empty(); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Method)) { return false; } Method other = (Method) obj; return Objects.equals(httpMethod(), other.httpMethod()) && Objects.equals(authorizationType(), other.authorizationType()) && Objects.equals(authorizerId(), other.authorizerId()) && Objects.equals(apiKeyRequired(), other.apiKeyRequired()) && Objects.equals(requestValidatorId(), other.requestValidatorId()) && Objects.equals(operationName(), other.operationName()) && Objects.equals(requestParameters(), other.requestParameters()) && Objects.equals(requestModels(), other.requestModels()) && Objects.equals(methodResponses(), other.methodResponses()) && Objects.equals(methodIntegration(), other.methodIntegration()) && Objects.equals(authorizationScopes(), other.authorizationScopes()); }