![JAR search and dependency download from the Maven repository](/logo.png)
software.amazon.awssdk.services.pinpoint.model.EndpointLocation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pinpoint Show documentation
Show all versions of pinpoint Show documentation
The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating
with Amazon Pinpoint Service
/*
* Copyright 2014-2019 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.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;
/**
* Location data for the endpoint.
*/
@Generated("software.amazon.awssdk:codegen")
public final class EndpointLocation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CITY_FIELD = SdkField. builder(MarshallingType.STRING)
.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)
.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)
.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)
.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)
.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)
.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 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 city where the endpoint is located.
*
* @return The city where the endpoint is located.
*/
public String city() {
return city;
}
/**
* The two-letter code for the country or region of the endpoint. Specified as an ISO 3166-1 alpha-2 code, such as
* "US" for the United States.
*
* @return The two-letter code for the country or region of the endpoint. Specified as an ISO 3166-1 alpha-2 code,
* such as "US" for the United States.
*/
public String country() {
return country;
}
/**
* The latitude of the endpoint location, rounded to one decimal place.
*
* @return The latitude of the endpoint location, rounded to one decimal place.
*/
public Double latitude() {
return latitude;
}
/**
* The longitude of the endpoint location, rounded to one decimal place.
*
* @return The longitude of the endpoint location, rounded to one decimal place.
*/
public Double longitude() {
return longitude;
}
/**
* The postal code or zip code of the endpoint.
*
* @return The postal code or zip code of the endpoint.
*/
public String postalCode() {
return postalCode;
}
/**
* The region of the endpoint location. For example, in the United States, this corresponds to a state.
*
* @return The region of the endpoint location. For example, in the United States, this corresponds to a state.
*/
public String region() {
return region;
}
@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 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 boolean equals(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 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 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 List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy