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

com.github.messenger4j.send.message.quickreply.TextQuickReply Maven / Gradle / Ivy

// Generated by delombok at Tue May 07 22:31:27 CEST 2019
package com.github.messenger4j.send.message.quickreply;

import static java.util.Optional.empty;

import java.net.URL;
import java.util.Optional;
import lombok.NonNull;

/**
 * @author Max Grabenhorst
 * @since 1.0.0
 */
public final class TextQuickReply extends QuickReply {
  private final String title;
  private final String payload;
  private final Optional imageUrl;

  private TextQuickReply(String title, String payload, Optional imageUrl) {
    super(ContentType.TEXT);
    this.title = title;
    this.payload = payload;
    this.imageUrl = imageUrl;
  }

  public static TextQuickReply create(@NonNull String title, @NonNull String payload) {
    if (title == null) {
      throw new java.lang.IllegalArgumentException("title is marked @NonNull but is null");
    }
    if (payload == null) {
      throw new java.lang.IllegalArgumentException("payload is marked @NonNull but is null");
    }
    return create(title, payload, empty());
  }

  public static TextQuickReply create(
      @NonNull String title, @NonNull String payload, @NonNull Optional imageUrl) {
    if (title == null) {
      throw new java.lang.IllegalArgumentException("title is marked @NonNull but is null");
    }
    if (payload == null) {
      throw new java.lang.IllegalArgumentException("payload is marked @NonNull but is null");
    }
    if (imageUrl == null) {
      throw new java.lang.IllegalArgumentException("imageUrl is marked @NonNull but is null");
    }
    return new TextQuickReply(title, payload, imageUrl);
  }

  public String title() {
    return title;
  }

  public String payload() {
    return payload;
  }

  public Optional imageUrl() {
    return imageUrl;
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  public java.lang.String toString() {
    return "TextQuickReply(super="
        + super.toString()
        + ", title="
        + this.title
        + ", payload="
        + this.payload
        + ", imageUrl="
        + this.imageUrl
        + ")";
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  public boolean equals(final java.lang.Object o) {
    if (o == this) return true;
    if (!(o instanceof TextQuickReply)) return false;
    final TextQuickReply other = (TextQuickReply) o;
    if (!other.canEqual((java.lang.Object) this)) return false;
    if (!super.equals(o)) return false;
    final java.lang.Object this$title = this.title;
    final java.lang.Object other$title = other.title;
    if (this$title == null ? other$title != null : !this$title.equals(other$title)) return false;
    final java.lang.Object this$payload = this.payload;
    final java.lang.Object other$payload = other.payload;
    if (this$payload == null ? other$payload != null : !this$payload.equals(other$payload))
      return false;
    final java.lang.Object this$imageUrl = this.imageUrl;
    final java.lang.Object other$imageUrl = other.imageUrl;
    if (this$imageUrl == null ? other$imageUrl != null : !this$imageUrl.equals(other$imageUrl))
      return false;
    return true;
  }

  @java.lang.SuppressWarnings("all")
  protected boolean canEqual(final java.lang.Object other) {
    return other instanceof TextQuickReply;
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  public int hashCode() {
    final int PRIME = 59;
    int result = super.hashCode();
    final java.lang.Object $title = this.title;
    result = result * PRIME + ($title == null ? 43 : $title.hashCode());
    final java.lang.Object $payload = this.payload;
    result = result * PRIME + ($payload == null ? 43 : $payload.hashCode());
    final java.lang.Object $imageUrl = this.imageUrl;
    result = result * PRIME + ($imageUrl == null ? 43 : $imageUrl.hashCode());
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy