com.github.messenger4j.exception.MessengerApiException Maven / Gradle / Ivy
// Generated by delombok at Tue May 07 22:31:27 CEST 2019
package com.github.messenger4j.exception;
import java.util.Optional;
import lombok.NonNull;
/**
* @author Max Grabenhorst
* @since 1.0.0
*/
public final class MessengerApiException extends Exception {
private final Optional type;
private final Optional code;
private final Optional fbTraceId;
public MessengerApiException(
@NonNull String message,
@NonNull Optional type,
@NonNull Optional code,
@NonNull Optional fbTraceId) {
super(message);
if (message == null) {
throw new java.lang.IllegalArgumentException("message is marked @NonNull but is null");
}
if (type == null) {
throw new java.lang.IllegalArgumentException("type is marked @NonNull but is null");
}
if (code == null) {
throw new java.lang.IllegalArgumentException("code is marked @NonNull but is null");
}
if (fbTraceId == null) {
throw new java.lang.IllegalArgumentException("fbTraceId is marked @NonNull but is null");
}
this.type = type;
this.code = code;
this.fbTraceId = fbTraceId;
}
public String message() {
return super.getMessage();
}
public Optional type() {
return type;
}
public Optional code() {
return code;
}
public Optional fbTraceId() {
return fbTraceId;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "MessengerApiException(super="
+ super.toString()
+ ", type="
+ this.type
+ ", code="
+ this.code
+ ", fbTraceId="
+ this.fbTraceId
+ ")";
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof MessengerApiException)) return false;
final MessengerApiException other = (MessengerApiException) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (!super.equals(o)) return false;
final java.lang.Object this$type = this.type;
final java.lang.Object other$type = other.type;
if (this$type == null ? other$type != null : !this$type.equals(other$type)) return false;
final java.lang.Object this$code = this.code;
final java.lang.Object other$code = other.code;
if (this$code == null ? other$code != null : !this$code.equals(other$code)) return false;
final java.lang.Object this$fbTraceId = this.fbTraceId;
final java.lang.Object other$fbTraceId = other.fbTraceId;
if (this$fbTraceId == null ? other$fbTraceId != null : !this$fbTraceId.equals(other$fbTraceId))
return false;
return true;
}
@java.lang.SuppressWarnings("all")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof MessengerApiException;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
final java.lang.Object $type = this.type;
result = result * PRIME + ($type == null ? 43 : $type.hashCode());
final java.lang.Object $code = this.code;
result = result * PRIME + ($code == null ? 43 : $code.hashCode());
final java.lang.Object $fbTraceId = this.fbTraceId;
result = result * PRIME + ($fbTraceId == null ? 43 : $fbTraceId.hashCode());
return result;
}
}