Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// 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 com.google.gson.annotations.SerializedName;
import java.util.Optional;
import lombok.NonNull;
/**
* @author Max Grabenhorst
* @since 1.0.0
*/
public final class Address {
@SerializedName("street_1")
private final String street1;
private final String city;
private final String postalCode;
private final String state;
private final String country;
@SerializedName("street_2")
private final Optional street2;
private Address(
String street1,
String city,
String postalCode,
String state,
String country,
Optional street2) {
this.street1 = street1;
this.city = city;
this.postalCode = postalCode;
this.state = state;
this.country = country;
this.street2 = street2;
}
public static Address create(
@NonNull String street1,
@NonNull String city,
@NonNull String postalCode,
@NonNull String state,
@NonNull String country) {
if (street1 == null) {
throw new java.lang.IllegalArgumentException("street1 is marked @NonNull but is null");
}
if (city == null) {
throw new java.lang.IllegalArgumentException("city is marked @NonNull but is null");
}
if (postalCode == null) {
throw new java.lang.IllegalArgumentException("postalCode is marked @NonNull but is null");
}
if (state == null) {
throw new java.lang.IllegalArgumentException("state is marked @NonNull but is null");
}
if (country == null) {
throw new java.lang.IllegalArgumentException("country is marked @NonNull but is null");
}
return create(street1, empty(), city, postalCode, state, country);
}
public static Address create(
@NonNull String street1,
@NonNull Optional street2,
@NonNull String city,
@NonNull String postalCode,
@NonNull String state,
@NonNull String country) {
if (street1 == null) {
throw new java.lang.IllegalArgumentException("street1 is marked @NonNull but is null");
}
if (street2 == null) {
throw new java.lang.IllegalArgumentException("street2 is marked @NonNull but is null");
}
if (city == null) {
throw new java.lang.IllegalArgumentException("city is marked @NonNull but is null");
}
if (postalCode == null) {
throw new java.lang.IllegalArgumentException("postalCode is marked @NonNull but is null");
}
if (state == null) {
throw new java.lang.IllegalArgumentException("state is marked @NonNull but is null");
}
if (country == null) {
throw new java.lang.IllegalArgumentException("country is marked @NonNull but is null");
}
return new Address(street1, city, postalCode, state, country, street2);
}
public String street1() {
return street1;
}
public String city() {
return city;
}
public String postalCode() {
return postalCode;
}
public String state() {
return state;
}
public String country() {
return country;
}
public Optional street2() {
return street2;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "Address(street1="
+ this.street1
+ ", city="
+ this.city
+ ", postalCode="
+ this.postalCode
+ ", state="
+ this.state
+ ", country="
+ this.country
+ ", street2="
+ this.street2
+ ")";
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof Address)) return false;
final Address other = (Address) o;
final java.lang.Object this$street1 = this.street1;
final java.lang.Object other$street1 = other.street1;
if (this$street1 == null ? other$street1 != null : !this$street1.equals(other$street1))
return false;
final java.lang.Object this$city = this.city;
final java.lang.Object other$city = other.city;
if (this$city == null ? other$city != null : !this$city.equals(other$city)) return false;
final java.lang.Object this$postalCode = this.postalCode;
final java.lang.Object other$postalCode = other.postalCode;
if (this$postalCode == null
? other$postalCode != null
: !this$postalCode.equals(other$postalCode)) return false;
final java.lang.Object this$state = this.state;
final java.lang.Object other$state = other.state;
if (this$state == null ? other$state != null : !this$state.equals(other$state)) return false;
final java.lang.Object this$country = this.country;
final java.lang.Object other$country = other.country;
if (this$country == null ? other$country != null : !this$country.equals(other$country))
return false;
final java.lang.Object this$street2 = this.street2;
final java.lang.Object other$street2 = other.street2;
if (this$street2 == null ? other$street2 != null : !this$street2.equals(other$street2))
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 $street1 = this.street1;
result = result * PRIME + ($street1 == null ? 43 : $street1.hashCode());
final java.lang.Object $city = this.city;
result = result * PRIME + ($city == null ? 43 : $city.hashCode());
final java.lang.Object $postalCode = this.postalCode;
result = result * PRIME + ($postalCode == null ? 43 : $postalCode.hashCode());
final java.lang.Object $state = this.state;
result = result * PRIME + ($state == null ? 43 : $state.hashCode());
final java.lang.Object $country = this.country;
result = result * PRIME + ($country == null ? 43 : $country.hashCode());
final java.lang.Object $street2 = this.street2;
result = result * PRIME + ($street2 == null ? 43 : $street2.hashCode());
return result;
}
}