software.amazon.awssdk.services.outposts.model.Address Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of outposts Show documentation
Show all versions of outposts Show documentation
The AWS Java SDK for Outposts module holds the client classes that are used for
communicating with Outposts.
/*
* 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.outposts.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;
/**
*
* Information about an address.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Address implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CONTACT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ContactName").getter(getter(Address::contactName)).setter(setter(Builder::contactName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContactName").build()).build();
private static final SdkField CONTACT_PHONE_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ContactPhoneNumber").getter(getter(Address::contactPhoneNumber))
.setter(setter(Builder::contactPhoneNumber))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContactPhoneNumber").build())
.build();
private static final SdkField ADDRESS_LINE1_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AddressLine1").getter(getter(Address::addressLine1)).setter(setter(Builder::addressLine1))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AddressLine1").build()).build();
private static final SdkField ADDRESS_LINE2_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AddressLine2").getter(getter(Address::addressLine2)).setter(setter(Builder::addressLine2))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AddressLine2").build()).build();
private static final SdkField ADDRESS_LINE3_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AddressLine3").getter(getter(Address::addressLine3)).setter(setter(Builder::addressLine3))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AddressLine3").build()).build();
private static final SdkField CITY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("City")
.getter(getter(Address::city)).setter(setter(Builder::city))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("City").build()).build();
private static final SdkField STATE_OR_REGION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StateOrRegion").getter(getter(Address::stateOrRegion)).setter(setter(Builder::stateOrRegion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateOrRegion").build()).build();
private static final SdkField DISTRICT_OR_COUNTY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DistrictOrCounty").getter(getter(Address::districtOrCounty)).setter(setter(Builder::districtOrCounty))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DistrictOrCounty").build()).build();
private static final SdkField POSTAL_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PostalCode").getter(getter(Address::postalCode)).setter(setter(Builder::postalCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PostalCode").build()).build();
private static final SdkField COUNTRY_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CountryCode").getter(getter(Address::countryCode)).setter(setter(Builder::countryCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CountryCode").build()).build();
private static final SdkField MUNICIPALITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Municipality").getter(getter(Address::municipality)).setter(setter(Builder::municipality))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Municipality").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONTACT_NAME_FIELD,
CONTACT_PHONE_NUMBER_FIELD, ADDRESS_LINE1_FIELD, ADDRESS_LINE2_FIELD, ADDRESS_LINE3_FIELD, CITY_FIELD,
STATE_OR_REGION_FIELD, DISTRICT_OR_COUNTY_FIELD, POSTAL_CODE_FIELD, COUNTRY_CODE_FIELD, MUNICIPALITY_FIELD));
private static final long serialVersionUID = 1L;
private final String contactName;
private final String contactPhoneNumber;
private final String addressLine1;
private final String addressLine2;
private final String addressLine3;
private final String city;
private final String stateOrRegion;
private final String districtOrCounty;
private final String postalCode;
private final String countryCode;
private final String municipality;
private Address(BuilderImpl builder) {
this.contactName = builder.contactName;
this.contactPhoneNumber = builder.contactPhoneNumber;
this.addressLine1 = builder.addressLine1;
this.addressLine2 = builder.addressLine2;
this.addressLine3 = builder.addressLine3;
this.city = builder.city;
this.stateOrRegion = builder.stateOrRegion;
this.districtOrCounty = builder.districtOrCounty;
this.postalCode = builder.postalCode;
this.countryCode = builder.countryCode;
this.municipality = builder.municipality;
}
/**
*
* The name of the contact.
*
*
* @return The name of the contact.
*/
public final String contactName() {
return contactName;
}
/**
*
* The phone number of the contact.
*
*
* @return The phone number of the contact.
*/
public final String contactPhoneNumber() {
return contactPhoneNumber;
}
/**
*
* The first line of the address.
*
*
* @return The first line of the address.
*/
public final String addressLine1() {
return addressLine1;
}
/**
*
* The second line of the address.
*
*
* @return The second line of the address.
*/
public final String addressLine2() {
return addressLine2;
}
/**
*
* The third line of the address.
*
*
* @return The third line of the address.
*/
public final String addressLine3() {
return addressLine3;
}
/**
*
* The city for the address.
*
*
* @return The city for the address.
*/
public final String city() {
return city;
}
/**
*
* The state for the address.
*
*
* @return The state for the address.
*/
public final String stateOrRegion() {
return stateOrRegion;
}
/**
*
* The district or county for the address.
*
*
* @return The district or county for the address.
*/
public final String districtOrCounty() {
return districtOrCounty;
}
/**
*
* The postal code for the address.
*
*
* @return The postal code for the address.
*/
public final String postalCode() {
return postalCode;
}
/**
*
* The ISO-3166 two-letter country code for the address.
*
*
* @return The ISO-3166 two-letter country code for the address.
*/
public final String countryCode() {
return countryCode;
}
/**
*
* The municipality for the address.
*
*
* @return The municipality for the address.
*/
public final String municipality() {
return municipality;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(contactName());
hashCode = 31 * hashCode + Objects.hashCode(contactPhoneNumber());
hashCode = 31 * hashCode + Objects.hashCode(addressLine1());
hashCode = 31 * hashCode + Objects.hashCode(addressLine2());
hashCode = 31 * hashCode + Objects.hashCode(addressLine3());
hashCode = 31 * hashCode + Objects.hashCode(city());
hashCode = 31 * hashCode + Objects.hashCode(stateOrRegion());
hashCode = 31 * hashCode + Objects.hashCode(districtOrCounty());
hashCode = 31 * hashCode + Objects.hashCode(postalCode());
hashCode = 31 * hashCode + Objects.hashCode(countryCode());
hashCode = 31 * hashCode + Objects.hashCode(municipality());
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 Address)) {
return false;
}
Address other = (Address) obj;
return Objects.equals(contactName(), other.contactName())
&& Objects.equals(contactPhoneNumber(), other.contactPhoneNumber())
&& Objects.equals(addressLine1(), other.addressLine1()) && Objects.equals(addressLine2(), other.addressLine2())
&& Objects.equals(addressLine3(), other.addressLine3()) && Objects.equals(city(), other.city())
&& Objects.equals(stateOrRegion(), other.stateOrRegion())
&& Objects.equals(districtOrCounty(), other.districtOrCounty())
&& Objects.equals(postalCode(), other.postalCode()) && Objects.equals(countryCode(), other.countryCode())
&& Objects.equals(municipality(), other.municipality());
}
/**
* 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("Address").add("ContactName", contactName()).add("ContactPhoneNumber", contactPhoneNumber())
.add("AddressLine1", addressLine1()).add("AddressLine2", addressLine2()).add("AddressLine3", addressLine3())
.add("City", city()).add("StateOrRegion", stateOrRegion()).add("DistrictOrCounty", districtOrCounty())
.add("PostalCode", postalCode()).add("CountryCode", countryCode()).add("Municipality", municipality()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ContactName":
return Optional.ofNullable(clazz.cast(contactName()));
case "ContactPhoneNumber":
return Optional.ofNullable(clazz.cast(contactPhoneNumber()));
case "AddressLine1":
return Optional.ofNullable(clazz.cast(addressLine1()));
case "AddressLine2":
return Optional.ofNullable(clazz.cast(addressLine2()));
case "AddressLine3":
return Optional.ofNullable(clazz.cast(addressLine3()));
case "City":
return Optional.ofNullable(clazz.cast(city()));
case "StateOrRegion":
return Optional.ofNullable(clazz.cast(stateOrRegion()));
case "DistrictOrCounty":
return Optional.ofNullable(clazz.cast(districtOrCounty()));
case "PostalCode":
return Optional.ofNullable(clazz.cast(postalCode()));
case "CountryCode":
return Optional.ofNullable(clazz.cast(countryCode()));
case "Municipality":
return Optional.ofNullable(clazz.cast(municipality()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy