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

software.amazon.awssdk.services.translate.model.TerminologyData 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.translate.model;

import java.io.Serializable;
import java.nio.ByteBuffer;
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.SdkBytes;
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 data associated with the custom terminology. For information about the custom terminology file, see Creating a Custom * Terminology. *

*/ @Generated("software.amazon.awssdk:codegen") public final class TerminologyData implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField FILE_FIELD = SdkField. builder(MarshallingType.SDK_BYTES) .memberName("File").getter(getter(TerminologyData::file)).setter(setter(Builder::file)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("File").build()).build(); private static final SdkField FORMAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Format") .getter(getter(TerminologyData::formatAsString)).setter(setter(Builder::format)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Format").build()).build(); private static final SdkField DIRECTIONALITY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Directionality").getter(getter(TerminologyData::directionalityAsString)) .setter(setter(Builder::directionality)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Directionality").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FILE_FIELD, FORMAT_FIELD, DIRECTIONALITY_FIELD)); private static final long serialVersionUID = 1L; private final SdkBytes file; private final String format; private final String directionality; private TerminologyData(BuilderImpl builder) { this.file = builder.file; this.format = builder.format; this.directionality = builder.directionality; } /** *

* The file containing the custom terminology data. Your version of the AWS SDK performs a Base64-encoding on this * field before sending a request to the AWS service. Users of the SDK should not perform Base64-encoding * themselves. *

* * @return The file containing the custom terminology data. Your version of the AWS SDK performs a Base64-encoding * on this field before sending a request to the AWS service. Users of the SDK should not perform * Base64-encoding themselves. */ public final SdkBytes file() { return file; } /** *

* The data format of the custom terminology. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #format} will * return {@link TerminologyDataFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #formatAsString}. *

* * @return The data format of the custom terminology. * @see TerminologyDataFormat */ public final TerminologyDataFormat format() { return TerminologyDataFormat.fromValue(format); } /** *

* The data format of the custom terminology. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #format} will * return {@link TerminologyDataFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #formatAsString}. *

* * @return The data format of the custom terminology. * @see TerminologyDataFormat */ public final String formatAsString() { return format; } /** *

* The directionality of your terminology resource indicates whether it has one source language (uni-directional) or * multiple (multi-directional). *

*
*
UNI
*
*

* The terminology resource has one source language (for example, the first column in a CSV file), and all of its * other languages are target languages. *

*
*
MULTI
*
*

* Any language in the terminology resource can be the source language or a target language. A single * multi-directional terminology resource can be used for jobs that translate different language pairs. For example, * if the terminology contains English and Spanish terms, it can be used for jobs that translate English to Spanish * and Spanish to English. *

*
*
*

* When you create a custom terminology resource without specifying the directionality, it behaves as * uni-directional terminology, although this parameter will have a null value. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #directionality} * will return {@link Directionality#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #directionalityAsString}. *

* * @return The directionality of your terminology resource indicates whether it has one source language * (uni-directional) or multiple (multi-directional).

*
*
UNI
*
*

* The terminology resource has one source language (for example, the first column in a CSV file), and all * of its other languages are target languages. *

*
*
MULTI
*
*

* Any language in the terminology resource can be the source language or a target language. A single * multi-directional terminology resource can be used for jobs that translate different language pairs. For * example, if the terminology contains English and Spanish terms, it can be used for jobs that translate * English to Spanish and Spanish to English. *

*
*
*

* When you create a custom terminology resource without specifying the directionality, it behaves as * uni-directional terminology, although this parameter will have a null value. * @see Directionality */ public final Directionality directionality() { return Directionality.fromValue(directionality); } /** *

* The directionality of your terminology resource indicates whether it has one source language (uni-directional) or * multiple (multi-directional). *

*
*
UNI
*
*

* The terminology resource has one source language (for example, the first column in a CSV file), and all of its * other languages are target languages. *

*
*
MULTI
*
*

* Any language in the terminology resource can be the source language or a target language. A single * multi-directional terminology resource can be used for jobs that translate different language pairs. For example, * if the terminology contains English and Spanish terms, it can be used for jobs that translate English to Spanish * and Spanish to English. *

*
*
*

* When you create a custom terminology resource without specifying the directionality, it behaves as * uni-directional terminology, although this parameter will have a null value. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #directionality} * will return {@link Directionality#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #directionalityAsString}. *

* * @return The directionality of your terminology resource indicates whether it has one source language * (uni-directional) or multiple (multi-directional).

*
*
UNI
*
*

* The terminology resource has one source language (for example, the first column in a CSV file), and all * of its other languages are target languages. *

*
*
MULTI
*
*

* Any language in the terminology resource can be the source language or a target language. A single * multi-directional terminology resource can be used for jobs that translate different language pairs. For * example, if the terminology contains English and Spanish terms, it can be used for jobs that translate * English to Spanish and Spanish to English. *

*
*
*

* When you create a custom terminology resource without specifying the directionality, it behaves as * uni-directional terminology, although this parameter will have a null value. * @see Directionality */ public final String directionalityAsString() { return directionality; } @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(file()); hashCode = 31 * hashCode + Objects.hashCode(formatAsString()); hashCode = 31 * hashCode + Objects.hashCode(directionalityAsString()); 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 TerminologyData)) { return false; } TerminologyData other = (TerminologyData) obj; return Objects.equals(file(), other.file()) && Objects.equals(formatAsString(), other.formatAsString()) && Objects.equals(directionalityAsString(), other.directionalityAsString()); } /** * 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("TerminologyData").add("File", file() == null ? null : "*** Sensitive Data Redacted ***") .add("Format", formatAsString()).add("Directionality", directionalityAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "File": return Optional.ofNullable(clazz.cast(file())); case "Format": return Optional.ofNullable(clazz.cast(formatAsString())); case "Directionality": return Optional.ofNullable(clazz.cast(directionalityAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((TerminologyData) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The file containing the custom terminology data. Your version of the AWS SDK performs a Base64-encoding on * this field before sending a request to the AWS service. Users of the SDK should not perform Base64-encoding * themselves. *

* * @param file * The file containing the custom terminology data. Your version of the AWS SDK performs a * Base64-encoding on this field before sending a request to the AWS service. Users of the SDK should not * perform Base64-encoding themselves. * @return Returns a reference to this object so that method calls can be chained together. */ Builder file(SdkBytes file); /** *

* The data format of the custom terminology. *

* * @param format * The data format of the custom terminology. * @see TerminologyDataFormat * @return Returns a reference to this object so that method calls can be chained together. * @see TerminologyDataFormat */ Builder format(String format); /** *

* The data format of the custom terminology. *

* * @param format * The data format of the custom terminology. * @see TerminologyDataFormat * @return Returns a reference to this object so that method calls can be chained together. * @see TerminologyDataFormat */ Builder format(TerminologyDataFormat format); /** *

* The directionality of your terminology resource indicates whether it has one source language * (uni-directional) or multiple (multi-directional). *

*
*
UNI
*
*

* The terminology resource has one source language (for example, the first column in a CSV file), and all of * its other languages are target languages. *

*
*
MULTI
*
*

* Any language in the terminology resource can be the source language or a target language. A single * multi-directional terminology resource can be used for jobs that translate different language pairs. For * example, if the terminology contains English and Spanish terms, it can be used for jobs that translate * English to Spanish and Spanish to English. *

*
*
*

* When you create a custom terminology resource without specifying the directionality, it behaves as * uni-directional terminology, although this parameter will have a null value. *

* * @param directionality * The directionality of your terminology resource indicates whether it has one source language * (uni-directional) or multiple (multi-directional).

*
*
UNI
*
*

* The terminology resource has one source language (for example, the first column in a CSV file), and * all of its other languages are target languages. *

*
*
MULTI
*
*

* Any language in the terminology resource can be the source language or a target language. A single * multi-directional terminology resource can be used for jobs that translate different language pairs. * For example, if the terminology contains English and Spanish terms, it can be used for jobs that * translate English to Spanish and Spanish to English. *

*
*
*

* When you create a custom terminology resource without specifying the directionality, it behaves as * uni-directional terminology, although this parameter will have a null value. * @see Directionality * @return Returns a reference to this object so that method calls can be chained together. * @see Directionality */ Builder directionality(String directionality); /** *

* The directionality of your terminology resource indicates whether it has one source language * (uni-directional) or multiple (multi-directional). *

*
*
UNI
*
*

* The terminology resource has one source language (for example, the first column in a CSV file), and all of * its other languages are target languages. *

*
*
MULTI
*
*

* Any language in the terminology resource can be the source language or a target language. A single * multi-directional terminology resource can be used for jobs that translate different language pairs. For * example, if the terminology contains English and Spanish terms, it can be used for jobs that translate * English to Spanish and Spanish to English. *

*
*
*

* When you create a custom terminology resource without specifying the directionality, it behaves as * uni-directional terminology, although this parameter will have a null value. *

* * @param directionality * The directionality of your terminology resource indicates whether it has one source language * (uni-directional) or multiple (multi-directional).

*
*
UNI
*
*

* The terminology resource has one source language (for example, the first column in a CSV file), and * all of its other languages are target languages. *

*
*
MULTI
*
*

* Any language in the terminology resource can be the source language or a target language. A single * multi-directional terminology resource can be used for jobs that translate different language pairs. * For example, if the terminology contains English and Spanish terms, it can be used for jobs that * translate English to Spanish and Spanish to English. *

*
*
*

* When you create a custom terminology resource without specifying the directionality, it behaves as * uni-directional terminology, although this parameter will have a null value. * @see Directionality * @return Returns a reference to this object so that method calls can be chained together. * @see Directionality */ Builder directionality(Directionality directionality); } static final class BuilderImpl implements Builder { private SdkBytes file; private String format; private String directionality; private BuilderImpl() { } private BuilderImpl(TerminologyData model) { file(model.file); format(model.format); directionality(model.directionality); } public final ByteBuffer getFile() { return file == null ? null : file.asByteBuffer(); } public final void setFile(ByteBuffer file) { file(file == null ? null : SdkBytes.fromByteBuffer(file)); } @Override public final Builder file(SdkBytes file) { this.file = file; return this; } public final String getFormat() { return format; } public final void setFormat(String format) { this.format = format; } @Override public final Builder format(String format) { this.format = format; return this; } @Override public final Builder format(TerminologyDataFormat format) { this.format(format == null ? null : format.toString()); return this; } public final String getDirectionality() { return directionality; } public final void setDirectionality(String directionality) { this.directionality = directionality; } @Override public final Builder directionality(String directionality) { this.directionality = directionality; return this; } @Override public final Builder directionality(Directionality directionality) { this.directionality(directionality == null ? null : directionality.toString()); return this; } @Override public TerminologyData build() { return new TerminologyData(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy