TranslatedTextItem Class

  • java.lang.Object
    • com.azure.ai.translation.text.models.TranslatedTextItem

Implements

public final class TranslatedTextItem
implements JsonSerializable<TranslatedTextItem>

Element containing the translated text.

Method Summary

Modifier and Type Method and Description
static TranslatedTextItem fromJson(JsonReader jsonReader)

Reads an instance of TranslatedTextItem from the JsonReader.

DetectedLanguage getDetectedLanguage()

Get the detectedLanguage property: The detectedLanguage property is only present in the result object when language auto-detection is requested.

List<TranslationText> getTranslations()

Get the translations property: An array of translation results.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Method Details

fromJson

public static TranslatedTextItem fromJson(JsonReader jsonReader)

Reads an instance of TranslatedTextItem from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of TranslatedTextItem if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getDetectedLanguage

public DetectedLanguage getDetectedLanguage()

Get the detectedLanguage property: The detectedLanguage property is only present in the result object when language auto-detection is requested.

Returns:

the detectedLanguage value.

getTranslations

public List<TranslationText> getTranslations()

Get the translations property: An array of translation results. The size of the array matches the number of target languages specified through the to query parameter.

Returns:

the translations value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to