com.github.messenger4j.send.message.TemplateMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of messenger4j Show documentation
Show all versions of messenger4j Show documentation
A Java library for building Chatbots on the Facebook Messenger Platform - easy and fast
The newest version!
// Generated by delombok at Tue May 07 22:31:27 CEST 2019
package com.github.messenger4j.send.message;
import static java.util.Optional.empty;
import com.github.messenger4j.send.message.quickreply.QuickReply;
import com.github.messenger4j.send.message.template.Template;
import java.util.List;
import java.util.Optional;
import lombok.NonNull;
/**
* @author Max Grabenhorst
* @since 1.0.0
*/
public final class TemplateMessage extends Message {
private final Template template;
private TemplateMessage(
Template template, Optional> quickReplies, Optional metadata) {
super(quickReplies, metadata);
this.template = template;
}
public static TemplateMessage create(@NonNull Template template) {
if (template == null) {
throw new java.lang.IllegalArgumentException("template is marked @NonNull but is null");
}
return create(template, empty(), empty());
}
public static TemplateMessage create(
@NonNull Template template,
@NonNull Optional> quickReplies,
@NonNull Optional metadata) {
if (template == null) {
throw new java.lang.IllegalArgumentException("template is marked @NonNull but is null");
}
if (quickReplies == null) {
throw new java.lang.IllegalArgumentException("quickReplies is marked @NonNull but is null");
}
if (metadata == null) {
throw new java.lang.IllegalArgumentException("metadata is marked @NonNull but is null");
}
return new TemplateMessage(template, quickReplies, metadata);
}
public Template template() {
return template;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "TemplateMessage(super=" + super.toString() + ", template=" + this.template + ")";
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof TemplateMessage)) return false;
final TemplateMessage other = (TemplateMessage) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (!super.equals(o)) return false;
final java.lang.Object this$template = this.template;
final java.lang.Object other$template = other.template;
if (this$template == null ? other$template != null : !this$template.equals(other$template))
return false;
return true;
}
@java.lang.SuppressWarnings("all")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof TemplateMessage;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
final java.lang.Object $template = this.template;
result = result * PRIME + ($template == null ? 43 : $template.hashCode());
return result;
}
}