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

com.cerner.beadledom.json.common.model.AutoValue_JsonError Maven / Gradle / Ivy

The newest version!
package com.cerner.beadledom.json.common.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import javax.annotation.Generated;
import javax.annotation.Nullable;

@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_JsonError extends JsonError {

  private final String message;

  private final int code;

  private final List errors;

  private AutoValue_JsonError(
      String message,
      int code,
      @Nullable List errors) {
    this.message = message;
    this.code = code;
    this.errors = errors;
  }

  @JsonProperty("message")
  @ApiModelProperty("Human readable description of an error")
  @Override
  public String message() {
    return message;
  }

  @JsonProperty("code")
  @ApiModelProperty("HTTP response status code representing the error")
  @Override
  public int code() {
    return code;
  }

  @Nullable
  @JsonProperty("errors")
  @ApiModelProperty("List of additional error details")
  @Override
  public List errors() {
    return errors;
  }

  @Override
  public String toString() {
    return "JsonError{"
        + "message=" + message + ", "
        + "code=" + code + ", "
        + "errors=" + errors
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof JsonError) {
      JsonError that = (JsonError) o;
      return this.message.equals(that.message())
          && this.code == that.code()
          && (this.errors == null ? that.errors() == null : this.errors.equals(that.errors()));
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h$ = 1;
    h$ *= 1000003;
    h$ ^= message.hashCode();
    h$ *= 1000003;
    h$ ^= code;
    h$ *= 1000003;
    h$ ^= (errors == null) ? 0 : errors.hashCode();
    return h$;
  }

  static final class Builder extends JsonError.Builder {
    private String message;
    private Integer code;
    private List errors;
    Builder() {
    }
    @Override
    public JsonError.Builder message(String message) {
      if (message == null) {
        throw new NullPointerException("Null message");
      }
      this.message = message;
      return this;
    }
    @Override
    public JsonError.Builder code(int code) {
      this.code = code;
      return this;
    }
    @Override
    public JsonError.Builder errors(List errors) {
      this.errors = errors;
      return this;
    }
    @Override
    public JsonError build() {
      String missing = "";
      if (this.message == null) {
        missing += " message";
      }
      if (this.code == null) {
        missing += " code";
      }
      if (!missing.isEmpty()) {
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_JsonError(
          this.message,
          this.code,
          this.errors);
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy