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

software.amazon.awssdk.services.mturk.model.Locale Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Mechanical Turk Requester module holds the client classes that are used for communicating with Amazon Mechanical Turk Requester 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.mturk.model;

import java.beans.Transient;
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;

/**
 * 

* The Locale data structure represents a geographical region or location. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Locale implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField COUNTRY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Country") .getter(getter(Locale::country)).setter(setter(Builder::country)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Country").build()).build(); private static final SdkField SUBDIVISION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Subdivision").getter(getter(Locale::subdivision)).setter(setter(Builder::subdivision)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Subdivision").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COUNTRY_FIELD, SUBDIVISION_FIELD)); private static final long serialVersionUID = 1L; private final String country; private final String subdivision; private Locale(BuilderImpl builder) { this.country = builder.country; this.subdivision = builder.subdivision; } /** *

* The country of the locale. Must be a valid ISO 3166 country code. For example, the code US refers to the United * States of America. *

* * @return The country of the locale. Must be a valid ISO 3166 country code. For example, the code US refers to the * United States of America. */ public final String country() { return country; } /** *

* The state or subdivision of the locale. A valid ISO 3166-2 subdivision code. For example, the code WA refers to * the state of Washington. *

* * @return The state or subdivision of the locale. A valid ISO 3166-2 subdivision code. For example, the code WA * refers to the state of Washington. */ public final String subdivision() { return subdivision; } @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(country()); hashCode = 31 * hashCode + Objects.hashCode(subdivision()); 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 Locale)) { return false; } Locale other = (Locale) obj; return Objects.equals(country(), other.country()) && Objects.equals(subdivision(), other.subdivision()); } /** * 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("Locale").add("Country", country()).add("Subdivision", subdivision()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Country": return Optional.ofNullable(clazz.cast(country())); case "Subdivision": return Optional.ofNullable(clazz.cast(subdivision())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Locale) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The country of the locale. Must be a valid ISO 3166 country code. For example, the code US refers to the * United States of America. *

* * @param country * The country of the locale. Must be a valid ISO 3166 country code. For example, the code US refers to * the United States of America. * @return Returns a reference to this object so that method calls can be chained together. */ Builder country(String country); /** *

* The state or subdivision of the locale. A valid ISO 3166-2 subdivision code. For example, the code WA refers * to the state of Washington. *

* * @param subdivision * The state or subdivision of the locale. A valid ISO 3166-2 subdivision code. For example, the code WA * refers to the state of Washington. * @return Returns a reference to this object so that method calls can be chained together. */ Builder subdivision(String subdivision); } static final class BuilderImpl implements Builder { private String country; private String subdivision; private BuilderImpl() { } private BuilderImpl(Locale model) { country(model.country); subdivision(model.subdivision); } public final String getCountry() { return country; } public final void setCountry(String country) { this.country = country; } @Override @Transient public final Builder country(String country) { this.country = country; return this; } public final String getSubdivision() { return subdivision; } public final void setSubdivision(String subdivision) { this.subdivision = subdivision; } @Override @Transient public final Builder subdivision(String subdivision) { this.subdivision = subdivision; return this; } @Override public Locale build() { return new Locale(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy