All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adyen.model.paymentsapp.DefaultErrorResponseEntity Maven / Gradle / Ivy

There is a newer version: 38.1.0
Show newest version
/*
 * Payments App API
 *
 * The version of the OpenAPI document: 1
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.adyen.model.paymentsapp;

import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.adyen.model.paymentsapp.InvalidField;
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.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.JsonProcessingException;


/**
 * Standardized error response following RFC-7807 format
 */
@JsonPropertyOrder({
  DefaultErrorResponseEntity.JSON_PROPERTY_DETAIL,
  DefaultErrorResponseEntity.JSON_PROPERTY_ERROR_CODE,
  DefaultErrorResponseEntity.JSON_PROPERTY_INSTANCE,
  DefaultErrorResponseEntity.JSON_PROPERTY_INVALID_FIELDS,
  DefaultErrorResponseEntity.JSON_PROPERTY_REQUEST_ID,
  DefaultErrorResponseEntity.JSON_PROPERTY_STATUS,
  DefaultErrorResponseEntity.JSON_PROPERTY_TITLE,
  DefaultErrorResponseEntity.JSON_PROPERTY_TYPE
})

public class DefaultErrorResponseEntity {
  public static final String JSON_PROPERTY_DETAIL = "detail";
  private String detail;

  public static final String JSON_PROPERTY_ERROR_CODE = "errorCode";
  private String errorCode;

  public static final String JSON_PROPERTY_INSTANCE = "instance";
  private String instance;

  public static final String JSON_PROPERTY_INVALID_FIELDS = "invalidFields";
  private List invalidFields;

  public static final String JSON_PROPERTY_REQUEST_ID = "requestId";
  private String requestId;

  public static final String JSON_PROPERTY_STATUS = "status";
  private Integer status;

  public static final String JSON_PROPERTY_TITLE = "title";
  private String title;

  public static final String JSON_PROPERTY_TYPE = "type";
  private String type;

  public DefaultErrorResponseEntity() { 
  }

  /**
   * A human-readable explanation specific to this occurrence of the problem.
   *
   * @param detail A human-readable explanation specific to this occurrence of the problem.
   * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining
   */
  public DefaultErrorResponseEntity detail(String detail) {
    this.detail = detail;
    return this;
  }

  /**
   * A human-readable explanation specific to this occurrence of the problem.
   * @return detail A human-readable explanation specific to this occurrence of the problem.
   */
  @JsonProperty(JSON_PROPERTY_DETAIL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getDetail() {
    return detail;
  }

  /**
   * A human-readable explanation specific to this occurrence of the problem.
   *
   * @param detail A human-readable explanation specific to this occurrence of the problem.
   */
  @JsonProperty(JSON_PROPERTY_DETAIL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setDetail(String detail) {
    this.detail = detail;
  }

  /**
   * Unique business error code.
   *
   * @param errorCode Unique business error code.
   * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining
   */
  public DefaultErrorResponseEntity errorCode(String errorCode) {
    this.errorCode = errorCode;
    return this;
  }

  /**
   * Unique business error code.
   * @return errorCode Unique business error code.
   */
  @JsonProperty(JSON_PROPERTY_ERROR_CODE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getErrorCode() {
    return errorCode;
  }

  /**
   * Unique business error code.
   *
   * @param errorCode Unique business error code.
   */
  @JsonProperty(JSON_PROPERTY_ERROR_CODE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setErrorCode(String errorCode) {
    this.errorCode = errorCode;
  }

  /**
   * A URI that identifies the specific occurrence of the problem if applicable.
   *
   * @param instance A URI that identifies the specific occurrence of the problem if applicable.
   * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining
   */
  public DefaultErrorResponseEntity instance(String instance) {
    this.instance = instance;
    return this;
  }

  /**
   * A URI that identifies the specific occurrence of the problem if applicable.
   * @return instance A URI that identifies the specific occurrence of the problem if applicable.
   */
  @JsonProperty(JSON_PROPERTY_INSTANCE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getInstance() {
    return instance;
  }

  /**
   * A URI that identifies the specific occurrence of the problem if applicable.
   *
   * @param instance A URI that identifies the specific occurrence of the problem if applicable.
   */
  @JsonProperty(JSON_PROPERTY_INSTANCE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setInstance(String instance) {
    this.instance = instance;
  }

  /**
   * Array of fields with validation errors when applicable.
   *
   * @param invalidFields Array of fields with validation errors when applicable.
   * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining
   */
  public DefaultErrorResponseEntity invalidFields(List invalidFields) {
    this.invalidFields = invalidFields;
    return this;
  }

  public DefaultErrorResponseEntity addInvalidFieldsItem(InvalidField invalidFieldsItem) {
    if (this.invalidFields == null) {
      this.invalidFields = new ArrayList<>();
    }
    this.invalidFields.add(invalidFieldsItem);
    return this;
  }

  /**
   * Array of fields with validation errors when applicable.
   * @return invalidFields Array of fields with validation errors when applicable.
   */
  @JsonProperty(JSON_PROPERTY_INVALID_FIELDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public List getInvalidFields() {
    return invalidFields;
  }

  /**
   * Array of fields with validation errors when applicable.
   *
   * @param invalidFields Array of fields with validation errors when applicable.
   */
  @JsonProperty(JSON_PROPERTY_INVALID_FIELDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setInvalidFields(List invalidFields) {
    this.invalidFields = invalidFields;
  }

  /**
   * The unique reference for the request.
   *
   * @param requestId The unique reference for the request.
   * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining
   */
  public DefaultErrorResponseEntity requestId(String requestId) {
    this.requestId = requestId;
    return this;
  }

  /**
   * The unique reference for the request.
   * @return requestId The unique reference for the request.
   */
  @JsonProperty(JSON_PROPERTY_REQUEST_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getRequestId() {
    return requestId;
  }

  /**
   * The unique reference for the request.
   *
   * @param requestId The unique reference for the request.
   */
  @JsonProperty(JSON_PROPERTY_REQUEST_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setRequestId(String requestId) {
    this.requestId = requestId;
  }

  /**
   * The HTTP status code.
   *
   * @param status The HTTP status code.
   * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining
   */
  public DefaultErrorResponseEntity status(Integer status) {
    this.status = status;
    return this;
  }

  /**
   * The HTTP status code.
   * @return status The HTTP status code.
   */
  @JsonProperty(JSON_PROPERTY_STATUS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public Integer getStatus() {
    return status;
  }

  /**
   * The HTTP status code.
   *
   * @param status The HTTP status code.
   */
  @JsonProperty(JSON_PROPERTY_STATUS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setStatus(Integer status) {
    this.status = status;
  }

  /**
   * A short, human-readable summary of the problem type.
   *
   * @param title A short, human-readable summary of the problem type.
   * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining
   */
  public DefaultErrorResponseEntity title(String title) {
    this.title = title;
    return this;
  }

  /**
   * A short, human-readable summary of the problem type.
   * @return title A short, human-readable summary of the problem type.
   */
  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getTitle() {
    return title;
  }

  /**
   * A short, human-readable summary of the problem type.
   *
   * @param title A short, human-readable summary of the problem type.
   */
  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setTitle(String title) {
    this.title = title;
  }

  /**
   * A URI that identifies the validation error type. It points to human-readable documentation for the problem type.
   *
   * @param type A URI that identifies the validation error type. It points to human-readable documentation for the problem type.
   * @return the current {@code DefaultErrorResponseEntity} instance, allowing for method chaining
   */
  public DefaultErrorResponseEntity type(String type) {
    this.type = type;
    return this;
  }

  /**
   * A URI that identifies the validation error type. It points to human-readable documentation for the problem type.
   * @return type A URI that identifies the validation error type. It points to human-readable documentation for the problem type.
   */
  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getType() {
    return type;
  }

  /**
   * A URI that identifies the validation error type. It points to human-readable documentation for the problem type.
   *
   * @param type A URI that identifies the validation error type. It points to human-readable documentation for the problem type.
   */
  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setType(String type) {
    this.type = type;
  }

  /**
   * Return true if this DefaultErrorResponseEntity object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    DefaultErrorResponseEntity defaultErrorResponseEntity = (DefaultErrorResponseEntity) o;
    return Objects.equals(this.detail, defaultErrorResponseEntity.detail) &&
        Objects.equals(this.errorCode, defaultErrorResponseEntity.errorCode) &&
        Objects.equals(this.instance, defaultErrorResponseEntity.instance) &&
        Objects.equals(this.invalidFields, defaultErrorResponseEntity.invalidFields) &&
        Objects.equals(this.requestId, defaultErrorResponseEntity.requestId) &&
        Objects.equals(this.status, defaultErrorResponseEntity.status) &&
        Objects.equals(this.title, defaultErrorResponseEntity.title) &&
        Objects.equals(this.type, defaultErrorResponseEntity.type);
  }

  @Override
  public int hashCode() {
    return Objects.hash(detail, errorCode, instance, invalidFields, requestId, status, title, type);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class DefaultErrorResponseEntity {\n");
    sb.append("    detail: ").append(toIndentedString(detail)).append("\n");
    sb.append("    errorCode: ").append(toIndentedString(errorCode)).append("\n");
    sb.append("    instance: ").append(toIndentedString(instance)).append("\n");
    sb.append("    invalidFields: ").append(toIndentedString(invalidFields)).append("\n");
    sb.append("    requestId: ").append(toIndentedString(requestId)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    title: ").append(toIndentedString(title)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).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 String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

/**
   * Create an instance of DefaultErrorResponseEntity given an JSON string
   *
   * @param jsonString JSON string
   * @return An instance of DefaultErrorResponseEntity
   * @throws JsonProcessingException if the JSON string is invalid with respect to DefaultErrorResponseEntity
   */
  public static DefaultErrorResponseEntity fromJson(String jsonString) throws JsonProcessingException {
    return JSON.getMapper().readValue(jsonString, DefaultErrorResponseEntity.class);
  }
/**
  * Convert an instance of DefaultErrorResponseEntity to an JSON string
  *
  * @return JSON string
  */
  public String toJson() throws JsonProcessingException {
    return JSON.getMapper().writeValueAsString(this);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy