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

com.github.messenger4j.send.message.template.common.Element Maven / Gradle / Ivy

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

import com.github.messenger4j.internal.Lists;
import com.github.messenger4j.send.message.template.button.Button;
import java.net.URL;
import java.util.List;
import java.util.Optional;
import lombok.NonNull;

/**
 * @author Max Grabenhorst
 * @since 1.0.0
 */
public final class Element {
  private final String title;
  private final Optional subtitle;
  private final Optional imageUrl;
  private final Optional defaultAction;
  private final Optional> buttons;

  private Element(
      String title,
      Optional subtitle,
      Optional imageUrl,
      Optional defaultAction,
      Optional> buttons) {
    this.title = title;
    this.subtitle = subtitle;
    this.imageUrl = imageUrl;
    this.defaultAction = defaultAction;
    this.buttons = buttons.map(Lists::immutableList);
  }

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

  public String title() {
    return title;
  }

  public Optional subtitle() {
    return subtitle;
  }

  public Optional imageUrl() {
    return imageUrl;
  }

  public Optional defaultAction() {
    return defaultAction;
  }

  public Optional> buttons() {
    return buttons;
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  public java.lang.String toString() {
    return "Element(title="
        + this.title
        + ", subtitle="
        + this.subtitle
        + ", imageUrl="
        + this.imageUrl
        + ", defaultAction="
        + this.defaultAction
        + ", buttons="
        + this.buttons
        + ")";
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  public boolean equals(final java.lang.Object o) {
    if (o == this) return true;
    if (!(o instanceof Element)) return false;
    final Element other = (Element) o;
    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$subtitle = this.subtitle;
    final java.lang.Object other$subtitle = other.subtitle;
    if (this$subtitle == null ? other$subtitle != null : !this$subtitle.equals(other$subtitle))
      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;
    final java.lang.Object this$defaultAction = this.defaultAction;
    final java.lang.Object other$defaultAction = other.defaultAction;
    if (this$defaultAction == null
        ? other$defaultAction != null
        : !this$defaultAction.equals(other$defaultAction)) return false;
    final java.lang.Object this$buttons = this.buttons;
    final java.lang.Object other$buttons = other.buttons;
    if (this$buttons == null ? other$buttons != null : !this$buttons.equals(other$buttons))
      return false;
    return true;
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy