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

com.github.messenger4j.messengerprofile.greeting.Greeting Maven / Gradle / Ivy

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import lombok.NonNull;

/**
 * @author Max Grabenhorst
 * @since 1.0.0
 */
public final class Greeting {
  public static final String USER_FIRST_NAME = "{{user_first_name}}";
  public static final String USER_LAST_NAME = "{{user_last_name}}";
  public static final String USER_FULL_NAME = "{{user_full_name}}";
  private final List localizedGreetings;

  private Greeting(List localizedGreetings) {
    this.localizedGreetings = Collections.unmodifiableList(localizedGreetings);
  }

  public static Greeting create(
      @NonNull String defaultGreetingText, @NonNull LocalizedGreeting... localizedGreetings) {
    if (defaultGreetingText == null) {
      throw new java.lang.IllegalArgumentException(
          "defaultGreetingText is marked @NonNull but is null");
    }
    if (localizedGreetings == null) {
      throw new java.lang.IllegalArgumentException(
          "localizedGreetings is marked @NonNull but is null");
    }
    final List localizedGreetingList =
        new ArrayList<>(localizedGreetings.length + 1);
    localizedGreetingList.add(LocalizedGreeting.create("default", defaultGreetingText));
    localizedGreetingList.addAll(Arrays.asList(localizedGreetings));
    return new Greeting(localizedGreetingList);
  }

  public List localizedGreetings() {
    return localizedGreetings;
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  public java.lang.String toString() {
    return "Greeting(localizedGreetings=" + this.localizedGreetings + ")";
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  public boolean equals(final java.lang.Object o) {
    if (o == this) return true;
    if (!(o instanceof Greeting)) return false;
    final Greeting other = (Greeting) o;
    final java.lang.Object this$localizedGreetings = this.localizedGreetings;
    final java.lang.Object other$localizedGreetings = other.localizedGreetings;
    if (this$localizedGreetings == null
        ? other$localizedGreetings != null
        : !this$localizedGreetings.equals(other$localizedGreetings)) 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 $localizedGreetings = this.localizedGreetings;
    result = result * PRIME + ($localizedGreetings == null ? 43 : $localizedGreetings.hashCode());
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy