All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.pinpoint.model.EndpointLocation Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating with Amazon Pinpoint Service

There is a newer version: 2.29.39
Show newest version
/*
 * 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.pinpoint.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;

/**
 * 

* Specifies geographic information about an endpoint. *

*/ @Generated("software.amazon.awssdk:codegen") public final class EndpointLocation implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CITY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("City") .getter(getter(EndpointLocation::city)).setter(setter(Builder::city)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("City").build()).build(); private static final SdkField COUNTRY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Country") .getter(getter(EndpointLocation::country)).setter(setter(Builder::country)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Country").build()).build(); private static final SdkField LATITUDE_FIELD = SdkField. builder(MarshallingType.DOUBLE) .memberName("Latitude").getter(getter(EndpointLocation::latitude)).setter(setter(Builder::latitude)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Latitude").build()).build(); private static final SdkField LONGITUDE_FIELD = SdkField. builder(MarshallingType.DOUBLE) .memberName("Longitude").getter(getter(EndpointLocation::longitude)).setter(setter(Builder::longitude)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Longitude").build()).build(); private static final SdkField POSTAL_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PostalCode").getter(getter(EndpointLocation::postalCode)).setter(setter(Builder::postalCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PostalCode").build()).build(); private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Region") .getter(getter(EndpointLocation::region)).setter(setter(Builder::region)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CITY_FIELD, COUNTRY_FIELD, LATITUDE_FIELD, LONGITUDE_FIELD, POSTAL_CODE_FIELD, REGION_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String city; private final String country; private final Double latitude; private final Double longitude; private final String postalCode; private final String region; private EndpointLocation(BuilderImpl builder) { this.city = builder.city; this.country = builder.country; this.latitude = builder.latitude; this.longitude = builder.longitude; this.postalCode = builder.postalCode; this.region = builder.region; } /** *

* The name of the city where the endpoint is located. *

* * @return The name of the city where the endpoint is located. */ public final String city() { return city; } /** *

* The two-character code, in ISO 3166-1 alpha-2 format, for the country or region where the endpoint is located. * For example, US for the United States. *

* * @return The two-character code, in ISO 3166-1 alpha-2 format, for the country or region where the endpoint is * located. For example, US for the United States. */ public final String country() { return country; } /** *

* The latitude coordinate of the endpoint location, rounded to one decimal place. *

* * @return The latitude coordinate of the endpoint location, rounded to one decimal place. */ public final Double latitude() { return latitude; } /** *

* The longitude coordinate of the endpoint location, rounded to one decimal place. *

* * @return The longitude coordinate of the endpoint location, rounded to one decimal place. */ public final Double longitude() { return longitude; } /** *

* The postal or ZIP code for the area where the endpoint is located. *

* * @return The postal or ZIP code for the area where the endpoint is located. */ public final String postalCode() { return postalCode; } /** *

* The name of the region where the endpoint is located. For locations in the United States, this value is the name * of a state. *

* * @return The name of the region where the endpoint is located. For locations in the United States, this value is * the name of a state. */ public final String region() { return region; } @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(city()); hashCode = 31 * hashCode + Objects.hashCode(country()); hashCode = 31 * hashCode + Objects.hashCode(latitude()); hashCode = 31 * hashCode + Objects.hashCode(longitude()); hashCode = 31 * hashCode + Objects.hashCode(postalCode()); hashCode = 31 * hashCode + Objects.hashCode(region()); 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 EndpointLocation)) { return false; } EndpointLocation other = (EndpointLocation) obj; return Objects.equals(city(), other.city()) && Objects.equals(country(), other.country()) && Objects.equals(latitude(), other.latitude()) && Objects.equals(longitude(), other.longitude()) && Objects.equals(postalCode(), other.postalCode()) && Objects.equals(region(), other.region()); } /** * 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("EndpointLocation").add("City", city()).add("Country", country()).add("Latitude", latitude()) .add("Longitude", longitude()).add("PostalCode", postalCode()).add("Region", region()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "City": return Optional.ofNullable(clazz.cast(city())); case "Country": return Optional.ofNullable(clazz.cast(country())); case "Latitude": return Optional.ofNullable(clazz.cast(latitude())); case "Longitude": return Optional.ofNullable(clazz.cast(longitude())); case "PostalCode": return Optional.ofNullable(clazz.cast(postalCode())); case "Region": return Optional.ofNullable(clazz.cast(region())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("City", CITY_FIELD); map.put("Country", COUNTRY_FIELD); map.put("Latitude", LATITUDE_FIELD); map.put("Longitude", LONGITUDE_FIELD); map.put("PostalCode", POSTAL_CODE_FIELD); map.put("Region", REGION_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((EndpointLocation) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the city where the endpoint is located. *

* * @param city * The name of the city where the endpoint is located. * @return Returns a reference to this object so that method calls can be chained together. */ Builder city(String city); /** *

* The two-character code, in ISO 3166-1 alpha-2 format, for the country or region where the endpoint is * located. For example, US for the United States. *

* * @param country * The two-character code, in ISO 3166-1 alpha-2 format, for the country or region where the endpoint is * located. For example, US for the United States. * @return Returns a reference to this object so that method calls can be chained together. */ Builder country(String country); /** *

* The latitude coordinate of the endpoint location, rounded to one decimal place. *

* * @param latitude * The latitude coordinate of the endpoint location, rounded to one decimal place. * @return Returns a reference to this object so that method calls can be chained together. */ Builder latitude(Double latitude); /** *

* The longitude coordinate of the endpoint location, rounded to one decimal place. *

* * @param longitude * The longitude coordinate of the endpoint location, rounded to one decimal place. * @return Returns a reference to this object so that method calls can be chained together. */ Builder longitude(Double longitude); /** *

* The postal or ZIP code for the area where the endpoint is located. *

* * @param postalCode * The postal or ZIP code for the area where the endpoint is located. * @return Returns a reference to this object so that method calls can be chained together. */ Builder postalCode(String postalCode); /** *

* The name of the region where the endpoint is located. For locations in the United States, this value is the * name of a state. *

* * @param region * The name of the region where the endpoint is located. For locations in the United States, this value * is the name of a state. * @return Returns a reference to this object so that method calls can be chained together. */ Builder region(String region); } static final class BuilderImpl implements Builder { private String city; private String country; private Double latitude; private Double longitude; private String postalCode; private String region; private BuilderImpl() { } private BuilderImpl(EndpointLocation model) { city(model.city); country(model.country); latitude(model.latitude); longitude(model.longitude); postalCode(model.postalCode); region(model.region); } public final String getCity() { return city; } public final void setCity(String city) { this.city = city; } @Override public final Builder city(String city) { this.city = city; return this; } public final String getCountry() { return country; } public final void setCountry(String country) { this.country = country; } @Override public final Builder country(String country) { this.country = country; return this; } public final Double getLatitude() { return latitude; } public final void setLatitude(Double latitude) { this.latitude = latitude; } @Override public final Builder latitude(Double latitude) { this.latitude = latitude; return this; } public final Double getLongitude() { return longitude; } public final void setLongitude(Double longitude) { this.longitude = longitude; } @Override public final Builder longitude(Double longitude) { this.longitude = longitude; return this; } public final String getPostalCode() { return postalCode; } public final void setPostalCode(String postalCode) { this.postalCode = postalCode; } @Override public final Builder postalCode(String postalCode) { this.postalCode = postalCode; return this; } public final String getRegion() { return region; } public final void setRegion(String region) { this.region = region; } @Override public final Builder region(String region) { this.region = region; return this; } @Override public EndpointLocation build() { return new EndpointLocation(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy