software.amazon.awssdk.services.polly.model.LexiconAttributes Maven / Gradle / Ivy
Show all versions of polly 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.polly.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* Contains metadata describing the lexicon such as the number of lexemes, language code, and so on. For more
* information, see Managing Lexicons.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class LexiconAttributes implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ALPHABET_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Alphabet").getter(getter(LexiconAttributes::alphabet)).setter(setter(Builder::alphabet))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Alphabet").build()).build();
private static final SdkField LANGUAGE_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LanguageCode").getter(getter(LexiconAttributes::languageCodeAsString))
.setter(setter(Builder::languageCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LanguageCode").build()).build();
private static final SdkField LAST_MODIFIED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModified").getter(getter(LexiconAttributes::lastModified)).setter(setter(Builder::lastModified))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModified").build()).build();
private static final SdkField LEXICON_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LexiconArn").getter(getter(LexiconAttributes::lexiconArn)).setter(setter(Builder::lexiconArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LexiconArn").build()).build();
private static final SdkField LEXEMES_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("LexemesCount").getter(getter(LexiconAttributes::lexemesCount)).setter(setter(Builder::lexemesCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LexemesCount").build()).build();
private static final SdkField SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Size")
.getter(getter(LexiconAttributes::size)).setter(setter(Builder::size))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Size").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ALPHABET_FIELD,
LANGUAGE_CODE_FIELD, LAST_MODIFIED_FIELD, LEXICON_ARN_FIELD, LEXEMES_COUNT_FIELD, SIZE_FIELD));
private static final long serialVersionUID = 1L;
private final String alphabet;
private final String languageCode;
private final Instant lastModified;
private final String lexiconArn;
private final Integer lexemesCount;
private final Integer size;
private LexiconAttributes(BuilderImpl builder) {
this.alphabet = builder.alphabet;
this.languageCode = builder.languageCode;
this.lastModified = builder.lastModified;
this.lexiconArn = builder.lexiconArn;
this.lexemesCount = builder.lexemesCount;
this.size = builder.size;
}
/**
*
* Phonetic alphabet used in the lexicon. Valid values are ipa
and x-sampa
.
*
*
* @return Phonetic alphabet used in the lexicon. Valid values are ipa
and x-sampa
.
*/
public final String alphabet() {
return alphabet;
}
/**
*
* Language code that the lexicon applies to. A lexicon with a language code such as "en" would be applied to all
* English languages (en-GB, en-US, en-AUS, en-WLS, and so on.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #languageCode} will
* return {@link LanguageCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #languageCodeAsString}.
*
*
* @return Language code that the lexicon applies to. A lexicon with a language code such as "en" would be applied
* to all English languages (en-GB, en-US, en-AUS, en-WLS, and so on.
* @see LanguageCode
*/
public final LanguageCode languageCode() {
return LanguageCode.fromValue(languageCode);
}
/**
*
* Language code that the lexicon applies to. A lexicon with a language code such as "en" would be applied to all
* English languages (en-GB, en-US, en-AUS, en-WLS, and so on.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #languageCode} will
* return {@link LanguageCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #languageCodeAsString}.
*
*
* @return Language code that the lexicon applies to. A lexicon with a language code such as "en" would be applied
* to all English languages (en-GB, en-US, en-AUS, en-WLS, and so on.
* @see LanguageCode
*/
public final String languageCodeAsString() {
return languageCode;
}
/**
*
* Date lexicon was last modified (a timestamp value).
*
*
* @return Date lexicon was last modified (a timestamp value).
*/
public final Instant lastModified() {
return lastModified;
}
/**
*
* Amazon Resource Name (ARN) of the lexicon.
*
*
* @return Amazon Resource Name (ARN) of the lexicon.
*/
public final String lexiconArn() {
return lexiconArn;
}
/**
*
* Number of lexemes in the lexicon.
*
*
* @return Number of lexemes in the lexicon.
*/
public final Integer lexemesCount() {
return lexemesCount;
}
/**
*
* Total size of the lexicon, in characters.
*
*
* @return Total size of the lexicon, in characters.
*/
public final Integer size() {
return size;
}
@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 + Objects.hashCode(alphabet());
hashCode = 31 * hashCode + Objects.hashCode(languageCodeAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastModified());
hashCode = 31 * hashCode + Objects.hashCode(lexiconArn());
hashCode = 31 * hashCode + Objects.hashCode(lexemesCount());
hashCode = 31 * hashCode + Objects.hashCode(size());
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 LexiconAttributes)) {
return false;
}
LexiconAttributes other = (LexiconAttributes) obj;
return Objects.equals(alphabet(), other.alphabet())
&& Objects.equals(languageCodeAsString(), other.languageCodeAsString())
&& Objects.equals(lastModified(), other.lastModified()) && Objects.equals(lexiconArn(), other.lexiconArn())
&& Objects.equals(lexemesCount(), other.lexemesCount()) && Objects.equals(size(), other.size());
}
/**
* 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("LexiconAttributes").add("Alphabet", alphabet()).add("LanguageCode", languageCodeAsString())
.add("LastModified", lastModified()).add("LexiconArn", lexiconArn()).add("LexemesCount", lexemesCount())
.add("Size", size()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Alphabet":
return Optional.ofNullable(clazz.cast(alphabet()));
case "LanguageCode":
return Optional.ofNullable(clazz.cast(languageCodeAsString()));
case "LastModified":
return Optional.ofNullable(clazz.cast(lastModified()));
case "LexiconArn":
return Optional.ofNullable(clazz.cast(lexiconArn()));
case "LexemesCount":
return Optional.ofNullable(clazz.cast(lexemesCount()));
case "Size":
return Optional.ofNullable(clazz.cast(size()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function