software.amazon.awssdk.services.snowball.model.Address Maven / Gradle / Ivy
Show all versions of snowball Show documentation
/*
* 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.snowball.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;
/**
*
* The address that you want the Snow device(s) associated with a specific job to be shipped to. Addresses are validated
* at the time of creation. The address you provide must be located within the serviceable area of your region. Although
* no individual elements of the Address
are required, if the address is invalid or unsupported, then an
* exception is thrown.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Address implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ADDRESS_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AddressId").getter(getter(Address::addressId)).setter(setter(Builder::addressId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AddressId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(Address::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField COMPANY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Company")
.getter(getter(Address::company)).setter(setter(Builder::company))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Company").build()).build();
private static final SdkField STREET1_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Street1")
.getter(getter(Address::street1)).setter(setter(Builder::street1))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Street1").build()).build();
private static final SdkField STREET2_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Street2")
.getter(getter(Address::street2)).setter(setter(Builder::street2))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Street2").build()).build();
private static final SdkField STREET3_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Street3")
.getter(getter(Address::street3)).setter(setter(Builder::street3))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Street3").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_PROVINCE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StateOrProvince").getter(getter(Address::stateOrProvince)).setter(setter(Builder::stateOrProvince))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateOrProvince").build()).build();
private static final SdkField PREFECTURE_OR_DISTRICT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PrefectureOrDistrict").getter(getter(Address::prefectureOrDistrict))
.setter(setter(Builder::prefectureOrDistrict))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PrefectureOrDistrict").build())
.build();
private static final SdkField LANDMARK_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Landmark").getter(getter(Address::landmark)).setter(setter(Builder::landmark))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Landmark").build()).build();
private static final SdkField COUNTRY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Country")
.getter(getter(Address::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(Address::postalCode)).setter(setter(Builder::postalCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PostalCode").build()).build();
private static final SdkField PHONE_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PhoneNumber").getter(getter(Address::phoneNumber)).setter(setter(Builder::phoneNumber))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhoneNumber").build()).build();
private static final SdkField IS_RESTRICTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsRestricted").getter(getter(Address::isRestricted)).setter(setter(Builder::isRestricted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsRestricted").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(Address::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ADDRESS_ID_FIELD, NAME_FIELD,
COMPANY_FIELD, STREET1_FIELD, STREET2_FIELD, STREET3_FIELD, CITY_FIELD, STATE_OR_PROVINCE_FIELD,
PREFECTURE_OR_DISTRICT_FIELD, LANDMARK_FIELD, COUNTRY_FIELD, POSTAL_CODE_FIELD, PHONE_NUMBER_FIELD,
IS_RESTRICTED_FIELD, TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String addressId;
private final String name;
private final String company;
private final String street1;
private final String street2;
private final String street3;
private final String city;
private final String stateOrProvince;
private final String prefectureOrDistrict;
private final String landmark;
private final String country;
private final String postalCode;
private final String phoneNumber;
private final Boolean isRestricted;
private final String type;
private Address(BuilderImpl builder) {
this.addressId = builder.addressId;
this.name = builder.name;
this.company = builder.company;
this.street1 = builder.street1;
this.street2 = builder.street2;
this.street3 = builder.street3;
this.city = builder.city;
this.stateOrProvince = builder.stateOrProvince;
this.prefectureOrDistrict = builder.prefectureOrDistrict;
this.landmark = builder.landmark;
this.country = builder.country;
this.postalCode = builder.postalCode;
this.phoneNumber = builder.phoneNumber;
this.isRestricted = builder.isRestricted;
this.type = builder.type;
}
/**
*
* The unique ID for an address.
*
*
* @return The unique ID for an address.
*/
public final String addressId() {
return addressId;
}
/**
*
* The name of a person to receive a Snow device at an address.
*
*
* @return The name of a person to receive a Snow device at an address.
*/
public final String name() {
return name;
}
/**
*
* The name of the company to receive a Snow device at an address.
*
*
* @return The name of the company to receive a Snow device at an address.
*/
public final String company() {
return company;
}
/**
*
* The first line in a street address that a Snow device is to be delivered to.
*
*
* @return The first line in a street address that a Snow device is to be delivered to.
*/
public final String street1() {
return street1;
}
/**
*
* The second line in a street address that a Snow device is to be delivered to.
*
*
* @return The second line in a street address that a Snow device is to be delivered to.
*/
public final String street2() {
return street2;
}
/**
*
* The third line in a street address that a Snow device is to be delivered to.
*
*
* @return The third line in a street address that a Snow device is to be delivered to.
*/
public final String street3() {
return street3;
}
/**
*
* The city in an address that a Snow device is to be delivered to.
*
*
* @return The city in an address that a Snow device is to be delivered to.
*/
public final String city() {
return city;
}
/**
*
* The state or province in an address that a Snow device is to be delivered to.
*
*
* @return The state or province in an address that a Snow device is to be delivered to.
*/
public final String stateOrProvince() {
return stateOrProvince;
}
/**
*
* This field is no longer used and the value is ignored.
*
*
* @return This field is no longer used and the value is ignored.
*/
public final String prefectureOrDistrict() {
return prefectureOrDistrict;
}
/**
*
* This field is no longer used and the value is ignored.
*
*
* @return This field is no longer used and the value is ignored.
*/
public final String landmark() {
return landmark;
}
/**
*
* The country in an address that a Snow device is to be delivered to.
*
*
* @return The country in an address that a Snow device is to be delivered to.
*/
public final String country() {
return country;
}
/**
*
* The postal code in an address that a Snow device is to be delivered to.
*
*
* @return The postal code in an address that a Snow device is to be delivered to.
*/
public final String postalCode() {
return postalCode;
}
/**
*
* The phone number associated with an address that a Snow device is to be delivered to.
*
*
* @return The phone number associated with an address that a Snow device is to be delivered to.
*/
public final String phoneNumber() {
return phoneNumber;
}
/**
*
* If the address you are creating is a primary address, then set this option to true. This field is not supported
* in most regions.
*
*
* @return If the address you are creating is a primary address, then set this option to true. This field is not
* supported in most regions.
*/
public final Boolean isRestricted() {
return isRestricted;
}
/**
*
* Differentiates between delivery address and pickup address in the customer account. Provided at job creation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link AddressType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return Differentiates between delivery address and pickup address in the customer account. Provided at job
* creation.
* @see AddressType
*/
public final AddressType type() {
return AddressType.fromValue(type);
}
/**
*
* Differentiates between delivery address and pickup address in the customer account. Provided at job creation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link AddressType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return Differentiates between delivery address and pickup address in the customer account. Provided at job
* creation.
* @see AddressType
*/
public final String typeAsString() {
return type;
}
@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(addressId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(company());
hashCode = 31 * hashCode + Objects.hashCode(street1());
hashCode = 31 * hashCode + Objects.hashCode(street2());
hashCode = 31 * hashCode + Objects.hashCode(street3());
hashCode = 31 * hashCode + Objects.hashCode(city());
hashCode = 31 * hashCode + Objects.hashCode(stateOrProvince());
hashCode = 31 * hashCode + Objects.hashCode(prefectureOrDistrict());
hashCode = 31 * hashCode + Objects.hashCode(landmark());
hashCode = 31 * hashCode + Objects.hashCode(country());
hashCode = 31 * hashCode + Objects.hashCode(postalCode());
hashCode = 31 * hashCode + Objects.hashCode(phoneNumber());
hashCode = 31 * hashCode + Objects.hashCode(isRestricted());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
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(addressId(), other.addressId()) && Objects.equals(name(), other.name())
&& Objects.equals(company(), other.company()) && Objects.equals(street1(), other.street1())
&& Objects.equals(street2(), other.street2()) && Objects.equals(street3(), other.street3())
&& Objects.equals(city(), other.city()) && Objects.equals(stateOrProvince(), other.stateOrProvince())
&& Objects.equals(prefectureOrDistrict(), other.prefectureOrDistrict())
&& Objects.equals(landmark(), other.landmark()) && Objects.equals(country(), other.country())
&& Objects.equals(postalCode(), other.postalCode()) && Objects.equals(phoneNumber(), other.phoneNumber())
&& Objects.equals(isRestricted(), other.isRestricted()) && Objects.equals(typeAsString(), other.typeAsString());
}
/**
* 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("AddressId", addressId()).add("Name", name()).add("Company", company())
.add("Street1", street1()).add("Street2", street2()).add("Street3", street3()).add("City", city())
.add("StateOrProvince", stateOrProvince()).add("PrefectureOrDistrict", prefectureOrDistrict())
.add("Landmark", landmark()).add("Country", country()).add("PostalCode", postalCode())
.add("PhoneNumber", phoneNumber()).add("IsRestricted", isRestricted()).add("Type", typeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AddressId":
return Optional.ofNullable(clazz.cast(addressId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Company":
return Optional.ofNullable(clazz.cast(company()));
case "Street1":
return Optional.ofNullable(clazz.cast(street1()));
case "Street2":
return Optional.ofNullable(clazz.cast(street2()));
case "Street3":
return Optional.ofNullable(clazz.cast(street3()));
case "City":
return Optional.ofNullable(clazz.cast(city()));
case "StateOrProvince":
return Optional.ofNullable(clazz.cast(stateOrProvince()));
case "PrefectureOrDistrict":
return Optional.ofNullable(clazz.cast(prefectureOrDistrict()));
case "Landmark":
return Optional.ofNullable(clazz.cast(landmark()));
case "Country":
return Optional.ofNullable(clazz.cast(country()));
case "PostalCode":
return Optional.ofNullable(clazz.cast(postalCode()));
case "PhoneNumber":
return Optional.ofNullable(clazz.cast(phoneNumber()));
case "IsRestricted":
return Optional.ofNullable(clazz.cast(isRestricted()));
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function