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