io.github.dengchen2020.core.support.model.ErrorResult Maven / Gradle / Ivy
package io.github.dengchen2020.core.support.model;
import io.github.dengchen2020.core.exception.BaseException;
/**
* 错误实体
*
* @author dengchen
* @since 2019/10/17 11:53
*/
public class ErrorResult {
private Integer error_code;
private String error_message;
private Object data;
public ErrorResult(BaseException e) {
this(e.getCode(), e.getMessage(), null);
}
public ErrorResult(String error_message) {
this.error_message = error_message;
}
public ErrorResult(Integer error_code, String error_message) {
this.error_code = error_code;
this.error_message = error_message;
}
public ErrorResult(Integer error_code, String error_message, Object data) {
this.error_code = error_code;
this.error_message = error_message;
this.data = data;
}
public ErrorResult() {
}
public ErrorResult data(Object object) {
this.data = object;
return this;
}
public Integer getError_code() {
return this.error_code;
}
public String getError_message() {
return this.error_message;
}
public Object getData() {
return this.data;
}
public void setError_code(Integer error_code) {
this.error_code = error_code;
}
public void setError_message(String error_message) {
this.error_message = error_message;
}
public void setData(Object data) {
this.data = data;
}
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof ErrorResult)) return false;
final ErrorResult other = (ErrorResult) o;
if (!other.canEqual((Object) this)) return false;
final Object this$error_code = this.getError_code();
final Object other$error_code = other.getError_code();
if (this$error_code == null ? other$error_code != null : !this$error_code.equals(other$error_code))
return false;
final Object this$error_message = this.getError_message();
final Object other$error_message = other.getError_message();
if (this$error_message == null ? other$error_message != null : !this$error_message.equals(other$error_message))
return false;
final Object this$data = this.getData();
final Object other$data = other.getData();
if (this$data == null ? other$data != null : !this$data.equals(other$data)) return false;
return true;
}
protected boolean canEqual(final Object other) {
return other instanceof ErrorResult;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $error_code = this.getError_code();
result = result * PRIME + ($error_code == null ? 43 : $error_code.hashCode());
final Object $error_message = this.getError_message();
result = result * PRIME + ($error_message == null ? 43 : $error_message.hashCode());
final Object $data = this.getData();
result = result * PRIME + ($data == null ? 43 : $data.hashCode());
return result;
}
public String toString() {
return "ErrorResult(error_code=" + this.getError_code() + ", error_message=" + this.getError_message() + ", data=" + this.getData() + ")";
}
}