software.amazon.awssdk.services.location.model.SearchPlaceIndexForSuggestionsRequest Maven / Gradle / Ivy
Show all versions of location 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.location.model;
import java.beans.Transient;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 SearchPlaceIndexForSuggestionsRequest extends LocationRequest implements
ToCopyableBuilder {
private static final SdkField> BIAS_POSITION_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("BiasPosition")
.getter(getter(SearchPlaceIndexForSuggestionsRequest::biasPosition))
.setter(setter(Builder::biasPosition))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BiasPosition").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.DOUBLE)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> FILTER_B_BOX_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("FilterBBox")
.getter(getter(SearchPlaceIndexForSuggestionsRequest::filterBBox))
.setter(setter(Builder::filterBBox))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FilterBBox").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.DOUBLE)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> FILTER_COUNTRIES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("FilterCountries")
.getter(getter(SearchPlaceIndexForSuggestionsRequest::filterCountries))
.setter(setter(Builder::filterCountries))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FilterCountries").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField INDEX_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IndexName").getter(getter(SearchPlaceIndexForSuggestionsRequest::indexName))
.setter(setter(Builder::indexName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("IndexName").build()).build();
private static final SdkField LANGUAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Language").getter(getter(SearchPlaceIndexForSuggestionsRequest::language))
.setter(setter(Builder::language))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Language").build()).build();
private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("MaxResults").getter(getter(SearchPlaceIndexForSuggestionsRequest::maxResults))
.setter(setter(Builder::maxResults))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxResults").build()).build();
private static final SdkField TEXT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Text")
.getter(getter(SearchPlaceIndexForSuggestionsRequest::text)).setter(setter(Builder::text))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Text").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BIAS_POSITION_FIELD,
FILTER_B_BOX_FIELD, FILTER_COUNTRIES_FIELD, INDEX_NAME_FIELD, LANGUAGE_FIELD, MAX_RESULTS_FIELD, TEXT_FIELD));
private final List biasPosition;
private final List filterBBox;
private final List filterCountries;
private final String indexName;
private final String language;
private final Integer maxResults;
private final String text;
private SearchPlaceIndexForSuggestionsRequest(BuilderImpl builder) {
super(builder);
this.biasPosition = builder.biasPosition;
this.filterBBox = builder.filterBBox;
this.filterCountries = builder.filterCountries;
this.indexName = builder.indexName;
this.language = builder.language;
this.maxResults = builder.maxResults;
this.text = builder.text;
}
/**
* For responses, this returns true if the service returned a value for the BiasPosition property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasBiasPosition() {
return biasPosition != null && !(biasPosition instanceof SdkAutoConstructList);
}
/**
*
* An optional parameter that indicates a preference for place suggestions that are closer to a specified position.
*
*
* If provided, this parameter must contain a pair of numbers. The first number represents the X coordinate, or
* longitude; the second number represents the Y coordinate, or latitude.
*
*
* For example, [-123.1174, 49.2847]
represents the position with longitude -123.1174
and
* latitude 49.2847
.
*
*
*
* BiasPosition
and FilterBBox
are mutually exclusive. Specifying both options results in
* an error.
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasBiasPosition} method.
*
*
* @return An optional parameter that indicates a preference for place suggestions that are closer to a specified
* position.
*
* If provided, this parameter must contain a pair of numbers. The first number represents the X coordinate,
* or longitude; the second number represents the Y coordinate, or latitude.
*
*
* For example, [-123.1174, 49.2847]
represents the position with longitude
* -123.1174
and latitude 49.2847
.
*
*
*
* BiasPosition
and FilterBBox
are mutually exclusive. Specifying both options
* results in an error.
*
*/
public final List biasPosition() {
return biasPosition;
}
/**
* For responses, this returns true if the service returned a value for the FilterBBox property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasFilterBBox() {
return filterBBox != null && !(filterBBox instanceof SdkAutoConstructList);
}
/**
*
* An optional parameter that limits the search results by returning only suggestions within a specified bounding
* box.
*
*
* If provided, this parameter must contain a total of four consecutive numbers in two pairs. The first pair of
* numbers represents the X and Y coordinates (longitude and latitude, respectively) of the southwest corner of the
* bounding box; the second pair of numbers represents the X and Y coordinates (longitude and latitude,
* respectively) of the northeast corner of the bounding box.
*
*
* For example, [-12.7935, -37.4835, -12.0684, -36.9542]
represents a bounding box where the southwest
* corner has longitude -12.7935
and latitude -37.4835
, and the northeast corner has
* longitude -12.0684
and latitude -36.9542
.
*
*
*
* FilterBBox
and BiasPosition
are mutually exclusive. Specifying both options results in
* an error.
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasFilterBBox} method.
*
*
* @return An optional parameter that limits the search results by returning only suggestions within a specified
* bounding box.
*
* If provided, this parameter must contain a total of four consecutive numbers in two pairs. The first pair
* of numbers represents the X and Y coordinates (longitude and latitude, respectively) of the southwest
* corner of the bounding box; the second pair of numbers represents the X and Y coordinates (longitude and
* latitude, respectively) of the northeast corner of the bounding box.
*
*
* For example, [-12.7935, -37.4835, -12.0684, -36.9542]
represents a bounding box where the
* southwest corner has longitude -12.7935
and latitude -37.4835
, and the
* northeast corner has longitude -12.0684
and latitude -36.9542
.
*
*
*
* FilterBBox
and BiasPosition
are mutually exclusive. Specifying both options
* results in an error.
*
*/
public final List filterBBox() {
return filterBBox;
}
/**
* For responses, this returns true if the service returned a value for the FilterCountries property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasFilterCountries() {
return filterCountries != null && !(filterCountries instanceof SdkAutoConstructList);
}
/**
*
* An optional parameter that limits the search results by returning only suggestions within the provided list of
* countries.
*
*
* -
*
* Use the ISO 3166 3-digit country code. For example,
* Australia uses three upper-case characters: AUS
.
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasFilterCountries} method.
*
*
* @return An optional parameter that limits the search results by returning only suggestions within the provided
* list of countries.
*
* -
*
* Use the ISO 3166 3-digit country code. For
* example, Australia uses three upper-case characters: AUS
.
*
*
*/
public final List filterCountries() {
return filterCountries;
}
/**
*
* The name of the place index resource you want to use for the search.
*
*
* @return The name of the place index resource you want to use for the search.
*/
public final String indexName() {
return indexName;
}
/**
*
* 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. It does not change which results are returned. If the
* language is not specified, or not supported for a particular result, the partner automatically chooses a language
* for the result.
*
*
* Used only when the partner selected is Here.
*
*
* @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. It does not change which results are returned. If
* the language is not specified, or not supported for a particular result, the partner automatically
* chooses a language for the result.
*
*
* Used only when the partner selected is Here.
*/
public final String language() {
return language;
}
/**
*
* An optional parameter. The maximum number of results returned per request.
*
*
* The default: 5
*
*
* @return An optional parameter. The maximum number of results returned per request.
*
* The default: 5
*/
public final Integer maxResults() {
return maxResults;
}
/**
*
* The free-form partial text to use to generate place suggestions. For example, eiffel tow
.
*
*
* @return The free-form partial text to use to generate place suggestions. For example, eiffel tow
.
*/
public final String text() {
return text;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(hasBiasPosition() ? biasPosition() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasFilterBBox() ? filterBBox() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasFilterCountries() ? filterCountries() : null);
hashCode = 31 * hashCode + Objects.hashCode(indexName());
hashCode = 31 * hashCode + Objects.hashCode(language());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
hashCode = 31 * hashCode + Objects.hashCode(text());
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 SearchPlaceIndexForSuggestionsRequest)) {
return false;
}
SearchPlaceIndexForSuggestionsRequest other = (SearchPlaceIndexForSuggestionsRequest) obj;
return hasBiasPosition() == other.hasBiasPosition() && Objects.equals(biasPosition(), other.biasPosition())
&& hasFilterBBox() == other.hasFilterBBox() && Objects.equals(filterBBox(), other.filterBBox())
&& hasFilterCountries() == other.hasFilterCountries()
&& Objects.equals(filterCountries(), other.filterCountries()) && Objects.equals(indexName(), other.indexName())
&& Objects.equals(language(), other.language()) && Objects.equals(maxResults(), other.maxResults())
&& Objects.equals(text(), other.text());
}
/**
* 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("SearchPlaceIndexForSuggestionsRequest")
.add("BiasPosition", biasPosition() == null ? null : "*** Sensitive Data Redacted ***")
.add("FilterBBox", filterBBox() == null ? null : "*** Sensitive Data Redacted ***")
.add("FilterCountries", hasFilterCountries() ? filterCountries() : null).add("IndexName", indexName())
.add("Language", language()).add("MaxResults", maxResults())
.add("Text", text() == null ? null : "*** Sensitive Data Redacted ***").build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BiasPosition":
return Optional.ofNullable(clazz.cast(biasPosition()));
case "FilterBBox":
return Optional.ofNullable(clazz.cast(filterBBox()));
case "FilterCountries":
return Optional.ofNullable(clazz.cast(filterCountries()));
case "IndexName":
return Optional.ofNullable(clazz.cast(indexName()));
case "Language":
return Optional.ofNullable(clazz.cast(language()));
case "MaxResults":
return Optional.ofNullable(clazz.cast(maxResults()));
case "Text":
return Optional.ofNullable(clazz.cast(text()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function