software.amazon.awssdk.services.customerprofiles.model.UpdateAddress Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.customerprofiles.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Updates associated with the address properties of a customer profile.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateAddress implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ADDRESS1_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Address1").getter(getter(UpdateAddress::address1)).setter(setter(Builder::address1))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Address1").build()).build();
private static final SdkField ADDRESS2_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Address2").getter(getter(UpdateAddress::address2)).setter(setter(Builder::address2))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Address2").build()).build();
private static final SdkField ADDRESS3_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Address3").getter(getter(UpdateAddress::address3)).setter(setter(Builder::address3))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Address3").build()).build();
private static final SdkField ADDRESS4_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Address4").getter(getter(UpdateAddress::address4)).setter(setter(Builder::address4))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Address4").build()).build();
private static final SdkField CITY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("City")
.getter(getter(UpdateAddress::city)).setter(setter(Builder::city))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("City").build()).build();
private static final SdkField COUNTY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("County")
.getter(getter(UpdateAddress::county)).setter(setter(Builder::county))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("County").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(UpdateAddress::state)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField PROVINCE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Province").getter(getter(UpdateAddress::province)).setter(setter(Builder::province))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Province").build()).build();
private static final SdkField COUNTRY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Country")
.getter(getter(UpdateAddress::country)).setter(setter(Builder::country))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Country").build()).build();
private static final SdkField POSTAL_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PostalCode").getter(getter(UpdateAddress::postalCode)).setter(setter(Builder::postalCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PostalCode").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ADDRESS1_FIELD,
ADDRESS2_FIELD, ADDRESS3_FIELD, ADDRESS4_FIELD, CITY_FIELD, COUNTY_FIELD, STATE_FIELD, PROVINCE_FIELD, COUNTRY_FIELD,
POSTAL_CODE_FIELD));
private static final long serialVersionUID = 1L;
private final String address1;
private final String address2;
private final String address3;
private final String address4;
private final String city;
private final String county;
private final String state;
private final String province;
private final String country;
private final String postalCode;
private UpdateAddress(BuilderImpl builder) {
this.address1 = builder.address1;
this.address2 = builder.address2;
this.address3 = builder.address3;
this.address4 = builder.address4;
this.city = builder.city;
this.county = builder.county;
this.state = builder.state;
this.province = builder.province;
this.country = builder.country;
this.postalCode = builder.postalCode;
}
/**
*
* The first line of a customer address.
*
*
* @return The first line of a customer address.
*/
public final String address1() {
return address1;
}
/**
*
* The second line of a customer address.
*
*
* @return The second line of a customer address.
*/
public final String address2() {
return address2;
}
/**
*
* The third line of a customer address.
*
*
* @return The third line of a customer address.
*/
public final String address3() {
return address3;
}
/**
*
* The fourth line of a customer address.
*
*
* @return The fourth line of a customer address.
*/
public final String address4() {
return address4;
}
/**
*
* The city in which a customer lives.
*
*
* @return The city in which a customer lives.
*/
public final String city() {
return city;
}
/**
*
* The county in which a customer lives.
*
*
* @return The county in which a customer lives.
*/
public final String county() {
return county;
}
/**
*
* The state in which a customer lives.
*
*
* @return The state in which a customer lives.
*/
public final String state() {
return state;
}
/**
*
* The province in which a customer lives.
*
*
* @return The province in which a customer lives.
*/
public final String province() {
return province;
}
/**
*
* The country in which a customer lives.
*
*
* @return The country in which a customer lives.
*/
public final String country() {
return country;
}
/**
*
* The postal code of a customer address.
*
*
* @return The postal code of a customer address.
*/
public final String postalCode() {
return postalCode;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(address1());
hashCode = 31 * hashCode + Objects.hashCode(address2());
hashCode = 31 * hashCode + Objects.hashCode(address3());
hashCode = 31 * hashCode + Objects.hashCode(address4());
hashCode = 31 * hashCode + Objects.hashCode(city());
hashCode = 31 * hashCode + Objects.hashCode(county());
hashCode = 31 * hashCode + Objects.hashCode(state());
hashCode = 31 * hashCode + Objects.hashCode(province());
hashCode = 31 * hashCode + Objects.hashCode(country());
hashCode = 31 * hashCode + Objects.hashCode(postalCode());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateAddress)) {
return false;
}
UpdateAddress other = (UpdateAddress) obj;
return Objects.equals(address1(), other.address1()) && Objects.equals(address2(), other.address2())
&& Objects.equals(address3(), other.address3()) && Objects.equals(address4(), other.address4())
&& Objects.equals(city(), other.city()) && Objects.equals(county(), other.county())
&& Objects.equals(state(), other.state()) && Objects.equals(province(), other.province())
&& Objects.equals(country(), other.country()) && Objects.equals(postalCode(), other.postalCode());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("UpdateAddress").add("Address1", address1()).add("Address2", address2())
.add("Address3", address3()).add("Address4", address4()).add("City", city()).add("County", county())
.add("State", state()).add("Province", province()).add("Country", country()).add("PostalCode", postalCode())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Address1":
return Optional.ofNullable(clazz.cast(address1()));
case "Address2":
return Optional.ofNullable(clazz.cast(address2()));
case "Address3":
return Optional.ofNullable(clazz.cast(address3()));
case "Address4":
return Optional.ofNullable(clazz.cast(address4()));
case "City":
return Optional.ofNullable(clazz.cast(city()));
case "County":
return Optional.ofNullable(clazz.cast(county()));
case "State":
return Optional.ofNullable(clazz.cast(state()));
case "Province":
return Optional.ofNullable(clazz.cast(province()));
case "Country":
return Optional.ofNullable(clazz.cast(country()));
case "PostalCode":
return Optional.ofNullable(clazz.cast(postalCode()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function