com.github.messenger4j.send.SenderActionPayload Maven / Gradle / Ivy
// Generated by delombok at Tue May 07 22:31:27 CEST 2019
package com.github.messenger4j.send;
import com.github.messenger4j.send.recipient.IdRecipient;
import com.github.messenger4j.send.recipient.Recipient;
import com.github.messenger4j.send.senderaction.SenderAction;
import lombok.NonNull;
/**
* @author Max Grabenhorst
* @since 1.0.0
*/
public final class SenderActionPayload extends Payload {
private final SenderAction senderAction;
private SenderActionPayload(Recipient recipient, SenderAction senderAction) {
super(recipient);
this.senderAction = senderAction;
}
public static SenderActionPayload create(
@NonNull String recipientId, @NonNull SenderAction senderAction) {
if (recipientId == null) {
throw new java.lang.IllegalArgumentException("recipientId is marked @NonNull but is null");
}
if (senderAction == null) {
throw new java.lang.IllegalArgumentException("senderAction is marked @NonNull but is null");
}
return create(IdRecipient.create(recipientId), senderAction);
}
public static SenderActionPayload create(
@NonNull Recipient recipient, @NonNull SenderAction senderAction) {
if (recipient == null) {
throw new java.lang.IllegalArgumentException("recipient is marked @NonNull but is null");
}
if (senderAction == null) {
throw new java.lang.IllegalArgumentException("senderAction is marked @NonNull but is null");
}
return new SenderActionPayload(recipient, senderAction);
}
public SenderAction senderAction() {
return senderAction;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "SenderActionPayload(super="
+ super.toString()
+ ", senderAction="
+ this.senderAction
+ ")";
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof SenderActionPayload)) return false;
final SenderActionPayload other = (SenderActionPayload) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (!super.equals(o)) return false;
final java.lang.Object this$senderAction = this.senderAction;
final java.lang.Object other$senderAction = other.senderAction;
if (this$senderAction == null
? other$senderAction != null
: !this$senderAction.equals(other$senderAction)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof SenderActionPayload;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
final java.lang.Object $senderAction = this.senderAction;
result = result * PRIME + ($senderAction == null ? 43 : $senderAction.hashCode());
return result;
}
}