com.github.messenger4j.messengerprofile.greeting.LocalizedGreeting Maven / Gradle / Ivy
// Generated by delombok at Tue May 07 22:31:27 CEST 2019
package com.github.messenger4j.messengerprofile.greeting;
import com.github.messenger4j.common.SupportedLocale;
import lombok.NonNull;
/**
* @author Max Grabenhorst
* @since 1.0.0
*/
public final class LocalizedGreeting {
private final String locale;
private final String text;
private LocalizedGreeting(String locale, String text) {
this.locale = locale;
this.text = text;
}
public static LocalizedGreeting create(@NonNull SupportedLocale locale, @NonNull String text) {
if (locale == null) {
throw new java.lang.IllegalArgumentException("locale is marked @NonNull but is null");
}
if (text == null) {
throw new java.lang.IllegalArgumentException("text is marked @NonNull but is null");
}
return create(locale.name(), text);
}
public static LocalizedGreeting create(@NonNull String locale, @NonNull String text) {
if (locale == null) {
throw new java.lang.IllegalArgumentException("locale is marked @NonNull but is null");
}
if (text == null) {
throw new java.lang.IllegalArgumentException("text is marked @NonNull but is null");
}
return new LocalizedGreeting(locale, text);
}
public String locale() {
return locale;
}
public String text() {
return text;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "LocalizedGreeting(locale=" + this.locale + ", text=" + this.text + ")";
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof LocalizedGreeting)) return false;
final LocalizedGreeting other = (LocalizedGreeting) o;
final java.lang.Object this$locale = this.locale;
final java.lang.Object other$locale = other.locale;
if (this$locale == null ? other$locale != null : !this$locale.equals(other$locale))
return false;
final java.lang.Object this$text = this.text;
final java.lang.Object other$text = other.text;
if (this$text == null ? other$text != null : !this$text.equals(other$text)) 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 $locale = this.locale;
result = result * PRIME + ($locale == null ? 43 : $locale.hashCode());
final java.lang.Object $text = this.text;
result = result * PRIME + ($text == null ? 43 : $text.hashCode());
return result;
}
}