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

software.amazon.awssdk.services.location.model.GetPlaceRequest 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.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.awscore.AwsRequestOverrideConfiguration;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class GetPlaceRequest extends LocationRequest implements ToCopyableBuilder {
    private static final SdkField INDEX_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("IndexName").getter(getter(GetPlaceRequest::indexName)).setter(setter(Builder::indexName))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("IndexName").build()).build();

    private static final SdkField PLACE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("PlaceId").getter(getter(GetPlaceRequest::placeId)).setter(setter(Builder::placeId))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("PlaceId").build()).build();

    private static final SdkField LANGUAGE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Language").getter(getter(GetPlaceRequest::language)).setter(setter(Builder::language))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("language").build()).build();

    private static final SdkField KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Key")
            .getter(getter(GetPlaceRequest::key)).setter(setter(Builder::key))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("key").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INDEX_NAME_FIELD,
            PLACE_ID_FIELD, LANGUAGE_FIELD, KEY_FIELD));

    private final String indexName;

    private final String placeId;

    private final String language;

    private final String key;

    private GetPlaceRequest(BuilderImpl builder) {
        super(builder);
        this.indexName = builder.indexName;
        this.placeId = builder.placeId;
        this.language = builder.language;
        this.key = builder.key;
    }

    /**
     * 

* The name of the place index resource that you want to use for the search. *

* * @return The name of the place index resource that you want to use for the search. */ public final String indexName() { return indexName; } /** *

* The identifier of the place to find. *

* * @return The identifier of the place to find. */ public final String placeId() { return placeId; } /** *

* The preferred language used to return results. The value must be a valid BCP 47 language tag, for example, en for English. *

*

* This setting affects the languages used in the results, but not the results themselves. If no language is * specified, or not supported for a particular result, the partner automatically chooses a language for the result. *

*

* For an example, we'll use the Greek language. You search for a location around Athens, Greece, with the * language parameter set to en. The city in the results will most likely be * returned as Athens. *

*

* If you set the language parameter to el, for Greek, then the city in the * results will more likely be returned as Αθήνα. *

*

* If the data provider does not have a value for Greek, the result will be in a language that the provider does * support. *

* * @return The preferred language used to return results. The value must be a valid BCP 47 language tag, for example, en for * English.

*

* This setting affects the languages used in the results, but not the results themselves. If no language is * specified, or not supported for a particular result, the partner automatically chooses a language for the * result. *

*

* For an example, we'll use the Greek language. You search for a location around Athens, Greece, with the * language parameter set to en. The city in the results will most * likely be returned as Athens. *

*

* If you set the language parameter to el, for Greek, then the city * in the results will more likely be returned as Αθήνα. *

*

* If the data provider does not have a value for Greek, the result will be in a language that the provider * does support. */ public final String language() { return language; } /** *

* The optional API key * to authorize the request. *

* * @return The optional API * key to authorize the request. */ public final String key() { return key; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(indexName()); hashCode = 31 * hashCode + Objects.hashCode(placeId()); hashCode = 31 * hashCode + Objects.hashCode(language()); hashCode = 31 * hashCode + Objects.hashCode(key()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GetPlaceRequest)) { return false; } GetPlaceRequest other = (GetPlaceRequest) obj; return Objects.equals(indexName(), other.indexName()) && Objects.equals(placeId(), other.placeId()) && Objects.equals(language(), other.language()) && Objects.equals(key(), other.key()); } /** * 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("GetPlaceRequest").add("IndexName", indexName()).add("PlaceId", placeId()) .add("Language", language()).add("Key", key() == null ? null : "*** Sensitive Data Redacted ***").build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "IndexName": return Optional.ofNullable(clazz.cast(indexName())); case "PlaceId": return Optional.ofNullable(clazz.cast(placeId())); case "Language": return Optional.ofNullable(clazz.cast(language())); case "Key": return Optional.ofNullable(clazz.cast(key())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetPlaceRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends LocationRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the place index resource that you want to use for the search. *

* * @param indexName * The name of the place index resource that you want to use for the search. * @return Returns a reference to this object so that method calls can be chained together. */ Builder indexName(String indexName); /** *

* The identifier of the place to find. *

* * @param placeId * The identifier of the place to find. * @return Returns a reference to this object so that method calls can be chained together. */ Builder placeId(String placeId); /** *

* The preferred language used to return results. The value must be a valid BCP 47 language tag, for example, en for English. *

*

* This setting affects the languages used in the results, but not the results themselves. If no language is * specified, or not supported for a particular result, the partner automatically chooses a language for the * result. *

*

* For an example, we'll use the Greek language. You search for a location around Athens, Greece, with the * language parameter set to en. The city in the results will most likely * be returned as Athens. *

*

* If you set the language parameter to el, for Greek, then the city in * the results will more likely be returned as Αθήνα. *

*

* If the data provider does not have a value for Greek, the result will be in a language that the provider does * support. *

* * @param language * The preferred language used to return results. The value must be a valid BCP 47 language tag, for example, en for * English.

*

* This setting affects the languages used in the results, but not the results themselves. If no language * is specified, or not supported for a particular result, the partner automatically chooses a language * for the result. *

*

* For an example, we'll use the Greek language. You search for a location around Athens, Greece, with * the language parameter set to en. The city in the results will * most likely be returned as Athens. *

*

* If you set the language parameter to el, for Greek, then the * city in the results will more likely be returned as Αθήνα. *

*

* If the data provider does not have a value for Greek, the result will be in a language that the * provider does support. * @return Returns a reference to this object so that method calls can be chained together. */ Builder language(String language); /** *

* The optional API * key to authorize the request. *

* * @param key * The optional API key to * authorize the request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder key(String key); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends LocationRequest.BuilderImpl implements Builder { private String indexName; private String placeId; private String language; private String key; private BuilderImpl() { } private BuilderImpl(GetPlaceRequest model) { super(model); indexName(model.indexName); placeId(model.placeId); language(model.language); key(model.key); } public final String getIndexName() { return indexName; } public final void setIndexName(String indexName) { this.indexName = indexName; } @Override public final Builder indexName(String indexName) { this.indexName = indexName; return this; } public final String getPlaceId() { return placeId; } public final void setPlaceId(String placeId) { this.placeId = placeId; } @Override public final Builder placeId(String placeId) { this.placeId = placeId; return this; } public final String getLanguage() { return language; } public final void setLanguage(String language) { this.language = language; } @Override public final Builder language(String language) { this.language = language; return this; } public final String getKey() { return key; } public final void setKey(String key) { this.key = key; } @Override public final Builder key(String key) { this.key = key; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public GetPlaceRequest build() { return new GetPlaceRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy