001package com.box.sdkgen.schemas.oauth2error;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.fasterxml.jackson.annotation.JsonFilter;
006import com.fasterxml.jackson.annotation.JsonProperty;
007import java.util.Objects;
008
009/** An OAuth 2.0 error. */
010@JsonFilter("nullablePropertyFilter")
011public class OAuth2Error extends SerializableObject {
012
013  /** The type of the error returned. */
014  protected String error;
015
016  /** The type of the error returned. */
017  @JsonProperty("error_description")
018  protected String errorDescription;
019
020  public OAuth2Error() {
021    super();
022  }
023
024  protected OAuth2Error(Builder builder) {
025    super();
026    this.error = builder.error;
027    this.errorDescription = builder.errorDescription;
028    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
029  }
030
031  public String getError() {
032    return error;
033  }
034
035  public String getErrorDescription() {
036    return errorDescription;
037  }
038
039  @Override
040  public boolean equals(Object o) {
041    if (this == o) {
042      return true;
043    }
044    if (o == null || getClass() != o.getClass()) {
045      return false;
046    }
047    OAuth2Error casted = (OAuth2Error) o;
048    return Objects.equals(error, casted.error)
049        && Objects.equals(errorDescription, casted.errorDescription);
050  }
051
052  @Override
053  public int hashCode() {
054    return Objects.hash(error, errorDescription);
055  }
056
057  @Override
058  public String toString() {
059    return "OAuth2Error{"
060        + "error='"
061        + error
062        + '\''
063        + ", "
064        + "errorDescription='"
065        + errorDescription
066        + '\''
067        + "}";
068  }
069
070  public static class Builder extends NullableFieldTracker {
071
072    protected String error;
073
074    protected String errorDescription;
075
076    public Builder error(String error) {
077      this.error = error;
078      return this;
079    }
080
081    public Builder errorDescription(String errorDescription) {
082      this.errorDescription = errorDescription;
083      return this;
084    }
085
086    public OAuth2Error build() {
087      return new OAuth2Error(this);
088    }
089  }
090}