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

software.amazon.awssdk.services.location.model.Place 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.location.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.Consumer;
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;

/**
 * 

* Contains details about addresses or points of interest that match the search criteria. *

*

* Not all details are included with all responses. Some details may only be returned by specific data partners. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Place implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ADDRESS_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AddressNumber").getter(getter(Place::addressNumber)).setter(setter(Builder::addressNumber)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AddressNumber").build()).build(); private static final SdkField COUNTRY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Country") .getter(getter(Place::country)).setter(setter(Builder::country)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Country").build()).build(); private static final SdkField GEOMETRY_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Geometry").getter(getter(Place::geometry)).setter(setter(Builder::geometry)) .constructor(PlaceGeometry::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Geometry").build()).build(); private static final SdkField INTERPOLATED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("Interpolated").getter(getter(Place::interpolated)).setter(setter(Builder::interpolated)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Interpolated").build()).build(); private static final SdkField LABEL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Label") .getter(getter(Place::label)).setter(setter(Builder::label)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Label").build()).build(); private static final SdkField MUNICIPALITY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Municipality").getter(getter(Place::municipality)).setter(setter(Builder::municipality)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Municipality").build()).build(); private static final SdkField NEIGHBORHOOD_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Neighborhood").getter(getter(Place::neighborhood)).setter(setter(Builder::neighborhood)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Neighborhood").build()).build(); private static final SdkField POSTAL_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PostalCode").getter(getter(Place::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(Place::region)).setter(setter(Builder::region)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region").build()).build(); private static final SdkField STREET_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Street") .getter(getter(Place::street)).setter(setter(Builder::street)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Street").build()).build(); private static final SdkField SUB_REGION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SubRegion").getter(getter(Place::subRegion)).setter(setter(Builder::subRegion)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubRegion").build()).build(); private static final SdkField TIME_ZONE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("TimeZone").getter(getter(Place::timeZone)).setter(setter(Builder::timeZone)) .constructor(TimeZone::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimeZone").build()).build(); private static final SdkField UNIT_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("UnitNumber").getter(getter(Place::unitNumber)).setter(setter(Builder::unitNumber)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UnitNumber").build()).build(); private static final SdkField UNIT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("UnitType").getter(getter(Place::unitType)).setter(setter(Builder::unitType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UnitType").build()).build(); private static final List> SDK_FIELDS = Collections .unmodifiableList(Arrays.asList(ADDRESS_NUMBER_FIELD, COUNTRY_FIELD, GEOMETRY_FIELD, INTERPOLATED_FIELD, LABEL_FIELD, MUNICIPALITY_FIELD, NEIGHBORHOOD_FIELD, POSTAL_CODE_FIELD, REGION_FIELD, STREET_FIELD, SUB_REGION_FIELD, TIME_ZONE_FIELD, UNIT_NUMBER_FIELD, UNIT_TYPE_FIELD)); private static final long serialVersionUID = 1L; private final String addressNumber; private final String country; private final PlaceGeometry geometry; private final Boolean interpolated; private final String label; private final String municipality; private final String neighborhood; private final String postalCode; private final String region; private final String street; private final String subRegion; private final TimeZone timeZone; private final String unitNumber; private final String unitType; private Place(BuilderImpl builder) { this.addressNumber = builder.addressNumber; this.country = builder.country; this.geometry = builder.geometry; this.interpolated = builder.interpolated; this.label = builder.label; this.municipality = builder.municipality; this.neighborhood = builder.neighborhood; this.postalCode = builder.postalCode; this.region = builder.region; this.street = builder.street; this.subRegion = builder.subRegion; this.timeZone = builder.timeZone; this.unitNumber = builder.unitNumber; this.unitType = builder.unitType; } /** *

* The numerical portion of an address, such as a building number. *

* * @return The numerical portion of an address, such as a building number. */ public final String addressNumber() { return addressNumber; } /** *

* A country/region specified using ISO 3166 3-digit * country/region code. For example, CAN. *

* * @return A country/region specified using ISO 3166 * 3-digit country/region code. For example, CAN. */ public final String country() { return country; } /** * Returns the value of the Geometry property for this object. * * @return The value of the Geometry property for this object. */ public final PlaceGeometry geometry() { return geometry; } /** *

* True if the result is interpolated from other known places. *

*

* False if the Place is a known place. *

*

* Not returned when the partner does not provide the information. *

*

* For example, returns False for an address location that is found in the partner data, but returns * True if an address does not exist in the partner data and its location is calculated by * interpolating between other known addresses. *

* * @return True if the result is interpolated from other known places.

*

* False if the Place is a known place. *

*

* Not returned when the partner does not provide the information. *

*

* For example, returns False for an address location that is found in the partner data, but * returns True if an address does not exist in the partner data and its location is calculated * by interpolating between other known addresses. */ public final Boolean interpolated() { return interpolated; } /** *

* The full name and address of the point of interest such as a city, region, or country. For example, * 123 Any Street, Any Town, USA. *

* * @return The full name and address of the point of interest such as a city, region, or country. For example, * 123 Any Street, Any Town, USA. */ public final String label() { return label; } /** *

* A name for a local area, such as a city or town name. For example, Toronto. *

* * @return A name for a local area, such as a city or town name. For example, Toronto. */ public final String municipality() { return municipality; } /** *

* The name of a community district. For example, Downtown. *

* * @return The name of a community district. For example, Downtown. */ public final String neighborhood() { return neighborhood; } /** *

* A group of numbers and letters in a country-specific format, which accompanies the address for the purpose of * identifying a location. *

* * @return A group of numbers and letters in a country-specific format, which accompanies the address for the * purpose of identifying a location. */ public final String postalCode() { return postalCode; } /** *

* A name for an area or geographical division, such as a province or state name. For example, * British Columbia. *

* * @return A name for an area or geographical division, such as a province or state name. For example, * British Columbia. */ public final String region() { return region; } /** *

* The name for a street or a road to identify a location. For example, Main Street. *

* * @return The name for a street or a road to identify a location. For example, Main Street. */ public final String street() { return street; } /** *

* A county, or an area that's part of a larger region. For example, Metro Vancouver. *

* * @return A county, or an area that's part of a larger region. For example, Metro Vancouver. */ public final String subRegion() { return subRegion; } /** *

* The time zone in which the Place is located. Returned only when using HERE as the selected partner. *

* * @return The time zone in which the Place is located. Returned only when using HERE as the selected * partner. */ public final TimeZone timeZone() { return timeZone; } /** *

* For addresses with multiple units, the unit identifier. Can include numbers and letters, for example * 3B or Unit 123. *

* *

* Returned only for a place index that uses Esri as a data provider. Is not returned for * SearchPlaceIndexForPosition. *

*
* * @return For addresses with multiple units, the unit identifier. Can include numbers and letters, for example * 3B or Unit 123.

*

* Returned only for a place index that uses Esri as a data provider. Is not returned for * SearchPlaceIndexForPosition. *

*/ public final String unitNumber() { return unitNumber; } /** *

* For addresses with a UnitNumber, the type of unit. For example, Apartment. *

* * @return For addresses with a UnitNumber, the type of unit. For example, Apartment. */ public final String unitType() { return unitType; } @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(addressNumber()); hashCode = 31 * hashCode + Objects.hashCode(country()); hashCode = 31 * hashCode + Objects.hashCode(geometry()); hashCode = 31 * hashCode + Objects.hashCode(interpolated()); hashCode = 31 * hashCode + Objects.hashCode(label()); hashCode = 31 * hashCode + Objects.hashCode(municipality()); hashCode = 31 * hashCode + Objects.hashCode(neighborhood()); hashCode = 31 * hashCode + Objects.hashCode(postalCode()); hashCode = 31 * hashCode + Objects.hashCode(region()); hashCode = 31 * hashCode + Objects.hashCode(street()); hashCode = 31 * hashCode + Objects.hashCode(subRegion()); hashCode = 31 * hashCode + Objects.hashCode(timeZone()); hashCode = 31 * hashCode + Objects.hashCode(unitNumber()); hashCode = 31 * hashCode + Objects.hashCode(unitType()); 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 Place)) { return false; } Place other = (Place) obj; return Objects.equals(addressNumber(), other.addressNumber()) && Objects.equals(country(), other.country()) && Objects.equals(geometry(), other.geometry()) && Objects.equals(interpolated(), other.interpolated()) && Objects.equals(label(), other.label()) && Objects.equals(municipality(), other.municipality()) && Objects.equals(neighborhood(), other.neighborhood()) && Objects.equals(postalCode(), other.postalCode()) && Objects.equals(region(), other.region()) && Objects.equals(street(), other.street()) && Objects.equals(subRegion(), other.subRegion()) && Objects.equals(timeZone(), other.timeZone()) && Objects.equals(unitNumber(), other.unitNumber()) && Objects.equals(unitType(), other.unitType()); } /** * 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("Place").add("AddressNumber", addressNumber()).add("Country", country()) .add("Geometry", geometry()).add("Interpolated", interpolated()).add("Label", label()) .add("Municipality", municipality()).add("Neighborhood", neighborhood()).add("PostalCode", postalCode()) .add("Region", region()).add("Street", street()).add("SubRegion", subRegion()).add("TimeZone", timeZone()) .add("UnitNumber", unitNumber()).add("UnitType", unitType()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AddressNumber": return Optional.ofNullable(clazz.cast(addressNumber())); case "Country": return Optional.ofNullable(clazz.cast(country())); case "Geometry": return Optional.ofNullable(clazz.cast(geometry())); case "Interpolated": return Optional.ofNullable(clazz.cast(interpolated())); case "Label": return Optional.ofNullable(clazz.cast(label())); case "Municipality": return Optional.ofNullable(clazz.cast(municipality())); case "Neighborhood": return Optional.ofNullable(clazz.cast(neighborhood())); case "PostalCode": return Optional.ofNullable(clazz.cast(postalCode())); case "Region": return Optional.ofNullable(clazz.cast(region())); case "Street": return Optional.ofNullable(clazz.cast(street())); case "SubRegion": return Optional.ofNullable(clazz.cast(subRegion())); case "TimeZone": return Optional.ofNullable(clazz.cast(timeZone())); case "UnitNumber": return Optional.ofNullable(clazz.cast(unitNumber())); case "UnitType": return Optional.ofNullable(clazz.cast(unitType())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Place) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The numerical portion of an address, such as a building number. *

* * @param addressNumber * The numerical portion of an address, such as a building number. * @return Returns a reference to this object so that method calls can be chained together. */ Builder addressNumber(String addressNumber); /** *

* A country/region specified using ISO 3166 * 3-digit country/region code. For example, CAN. *

* * @param country * A country/region specified using ISO * 3166 3-digit country/region code. For example, CAN. * @return Returns a reference to this object so that method calls can be chained together. */ Builder country(String country); /** * Sets the value of the Geometry property for this object. * * @param geometry * The new value for the Geometry property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder geometry(PlaceGeometry geometry); /** * Sets the value of the Geometry property for this object. * * This is a convenience method that creates an instance of the {@link PlaceGeometry.Builder} avoiding the need * to create one manually via {@link PlaceGeometry#builder()}. * *

* When the {@link Consumer} completes, {@link PlaceGeometry.Builder#build()} is called immediately and its * result is passed to {@link #geometry(PlaceGeometry)}. * * @param geometry * a consumer that will call methods on {@link PlaceGeometry.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #geometry(PlaceGeometry) */ default Builder geometry(Consumer geometry) { return geometry(PlaceGeometry.builder().applyMutation(geometry).build()); } /** *

* True if the result is interpolated from other known places. *

*

* False if the Place is a known place. *

*

* Not returned when the partner does not provide the information. *

*

* For example, returns False for an address location that is found in the partner data, but * returns True if an address does not exist in the partner data and its location is calculated by * interpolating between other known addresses. *

* * @param interpolated * True if the result is interpolated from other known places.

*

* False if the Place is a known place. *

*

* Not returned when the partner does not provide the information. *

*

* For example, returns False for an address location that is found in the partner data, but * returns True if an address does not exist in the partner data and its location is * calculated by interpolating between other known addresses. * @return Returns a reference to this object so that method calls can be chained together. */ Builder interpolated(Boolean interpolated); /** *

* The full name and address of the point of interest such as a city, region, or country. For example, * 123 Any Street, Any Town, USA. *

* * @param label * The full name and address of the point of interest such as a city, region, or country. For example, * 123 Any Street, Any Town, USA. * @return Returns a reference to this object so that method calls can be chained together. */ Builder label(String label); /** *

* A name for a local area, such as a city or town name. For example, Toronto. *

* * @param municipality * A name for a local area, such as a city or town name. For example, Toronto. * @return Returns a reference to this object so that method calls can be chained together. */ Builder municipality(String municipality); /** *

* The name of a community district. For example, Downtown. *

* * @param neighborhood * The name of a community district. For example, Downtown. * @return Returns a reference to this object so that method calls can be chained together. */ Builder neighborhood(String neighborhood); /** *

* A group of numbers and letters in a country-specific format, which accompanies the address for the purpose of * identifying a location. *

* * @param postalCode * A group of numbers and letters in a country-specific format, which accompanies the address for the * purpose of identifying a location. * @return Returns a reference to this object so that method calls can be chained together. */ Builder postalCode(String postalCode); /** *

* A name for an area or geographical division, such as a province or state name. For example, * British Columbia. *

* * @param region * A name for an area or geographical division, such as a province or state name. For example, * British Columbia. * @return Returns a reference to this object so that method calls can be chained together. */ Builder region(String region); /** *

* The name for a street or a road to identify a location. For example, Main Street. *

* * @param street * The name for a street or a road to identify a location. For example, Main Street. * @return Returns a reference to this object so that method calls can be chained together. */ Builder street(String street); /** *

* A county, or an area that's part of a larger region. For example, Metro Vancouver. *

* * @param subRegion * A county, or an area that's part of a larger region. For example, Metro Vancouver. * @return Returns a reference to this object so that method calls can be chained together. */ Builder subRegion(String subRegion); /** *

* The time zone in which the Place is located. Returned only when using HERE as the selected * partner. *

* * @param timeZone * The time zone in which the Place is located. Returned only when using HERE as the * selected partner. * @return Returns a reference to this object so that method calls can be chained together. */ Builder timeZone(TimeZone timeZone); /** *

* The time zone in which the Place is located. Returned only when using HERE as the selected * partner. *

* This is a convenience method that creates an instance of the {@link TimeZone.Builder} avoiding the need to * create one manually via {@link TimeZone#builder()}. * *

* When the {@link Consumer} completes, {@link TimeZone.Builder#build()} is called immediately and its result is * passed to {@link #timeZone(TimeZone)}. * * @param timeZone * a consumer that will call methods on {@link TimeZone.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #timeZone(TimeZone) */ default Builder timeZone(Consumer timeZone) { return timeZone(TimeZone.builder().applyMutation(timeZone).build()); } /** *

* For addresses with multiple units, the unit identifier. Can include numbers and letters, for example * 3B or Unit 123. *

* *

* Returned only for a place index that uses Esri as a data provider. Is not returned for * SearchPlaceIndexForPosition. *

*
* * @param unitNumber * For addresses with multiple units, the unit identifier. Can include numbers and letters, for example * 3B or Unit 123.

*

* Returned only for a place index that uses Esri as a data provider. Is not returned for * SearchPlaceIndexForPosition. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder unitNumber(String unitNumber); /** *

* For addresses with a UnitNumber, the type of unit. For example, Apartment. *

* * @param unitType * For addresses with a UnitNumber, the type of unit. For example, Apartment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder unitType(String unitType); } static final class BuilderImpl implements Builder { private String addressNumber; private String country; private PlaceGeometry geometry; private Boolean interpolated; private String label; private String municipality; private String neighborhood; private String postalCode; private String region; private String street; private String subRegion; private TimeZone timeZone; private String unitNumber; private String unitType; private BuilderImpl() { } private BuilderImpl(Place model) { addressNumber(model.addressNumber); country(model.country); geometry(model.geometry); interpolated(model.interpolated); label(model.label); municipality(model.municipality); neighborhood(model.neighborhood); postalCode(model.postalCode); region(model.region); street(model.street); subRegion(model.subRegion); timeZone(model.timeZone); unitNumber(model.unitNumber); unitType(model.unitType); } public final String getAddressNumber() { return addressNumber; } public final void setAddressNumber(String addressNumber) { this.addressNumber = addressNumber; } @Override public final Builder addressNumber(String addressNumber) { this.addressNumber = addressNumber; 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 PlaceGeometry.Builder getGeometry() { return geometry != null ? geometry.toBuilder() : null; } public final void setGeometry(PlaceGeometry.BuilderImpl geometry) { this.geometry = geometry != null ? geometry.build() : null; } @Override public final Builder geometry(PlaceGeometry geometry) { this.geometry = geometry; return this; } public final Boolean getInterpolated() { return interpolated; } public final void setInterpolated(Boolean interpolated) { this.interpolated = interpolated; } @Override public final Builder interpolated(Boolean interpolated) { this.interpolated = interpolated; return this; } public final String getLabel() { return label; } public final void setLabel(String label) { this.label = label; } @Override public final Builder label(String label) { this.label = label; return this; } public final String getMunicipality() { return municipality; } public final void setMunicipality(String municipality) { this.municipality = municipality; } @Override public final Builder municipality(String municipality) { this.municipality = municipality; return this; } public final String getNeighborhood() { return neighborhood; } public final void setNeighborhood(String neighborhood) { this.neighborhood = neighborhood; } @Override public final Builder neighborhood(String neighborhood) { this.neighborhood = neighborhood; 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; } public final String getStreet() { return street; } public final void setStreet(String street) { this.street = street; } @Override public final Builder street(String street) { this.street = street; return this; } public final String getSubRegion() { return subRegion; } public final void setSubRegion(String subRegion) { this.subRegion = subRegion; } @Override public final Builder subRegion(String subRegion) { this.subRegion = subRegion; return this; } public final TimeZone.Builder getTimeZone() { return timeZone != null ? timeZone.toBuilder() : null; } public final void setTimeZone(TimeZone.BuilderImpl timeZone) { this.timeZone = timeZone != null ? timeZone.build() : null; } @Override public final Builder timeZone(TimeZone timeZone) { this.timeZone = timeZone; return this; } public final String getUnitNumber() { return unitNumber; } public final void setUnitNumber(String unitNumber) { this.unitNumber = unitNumber; } @Override public final Builder unitNumber(String unitNumber) { this.unitNumber = unitNumber; return this; } public final String getUnitType() { return unitType; } public final void setUnitType(String unitType) { this.unitType = unitType; } @Override public final Builder unitType(String unitType) { this.unitType = unitType; return this; } @Override public Place build() { return new Place(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy