Class TranslationResultImpl
- java.lang.Object
-
- com.adobe.granite.translation.core.common.TranslationResultImpl
-
- All Implemented Interfaces:
TranslationResult
public class TranslationResultImpl extends java.lang.Object implements TranslationResult
-
-
Field Summary
Fields Modifier and Type Field Description static int
UNKNOWN_RATING
-
Constructor Summary
Constructors Constructor Description TranslationResultImpl(java.lang.String translation, java.lang.String sourceLang, java.lang.String targetLang, TranslationConstants.ContentType contentType, java.lang.String category, java.lang.String source, int rating, java.lang.String userId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCategory()
Gets the category.TranslationConstants.ContentType
getContentType()
Gets the content type.int
getRating()
Gets the rating.java.lang.String
getSourceLanguage()
Gets the source language.java.lang.String
getSourceString()
Gets the source string.java.lang.String
getTargetLanguage()
Gets the target language.java.lang.String
getTranslation()
Gets the translation.java.lang.String
getUserId()
Gets the user id.
-
-
-
Constructor Detail
-
TranslationResultImpl
public TranslationResultImpl(java.lang.String translation, java.lang.String sourceLang, java.lang.String targetLang, TranslationConstants.ContentType contentType, java.lang.String category, java.lang.String source, int rating, java.lang.String userId)
-
-
Method Detail
-
getTranslation
public java.lang.String getTranslation()
Description copied from interface:TranslationResult
Gets the translation.- Specified by:
getTranslation
in interfaceTranslationResult
- Returns:
- The translation response from the Machine Translation engine
-
getSourceLanguage
public java.lang.String getSourceLanguage()
Description copied from interface:TranslationResult
Gets the source language.- Specified by:
getSourceLanguage
in interfaceTranslationResult
- Returns:
- The original source language. If this was not specified during the translation call it is determined by leveraging the Translation Detection functionality
-
getTargetLanguage
public java.lang.String getTargetLanguage()
Description copied from interface:TranslationResult
Gets the target language.- Specified by:
getTargetLanguage
in interfaceTranslationResult
- Returns:
- The target language. If this was not specified during the translation call it may be determined based on the Resource path, Resource locale, or locale of the user.
-
getContentType
public TranslationConstants.ContentType getContentType()
Description copied from interface:TranslationResult
Gets the content type.- Specified by:
getContentType
in interfaceTranslationResult
- Returns:
- The content type of the Source String and the Target String it was translated into.
-
getCategory
public java.lang.String getCategory()
Description copied from interface:TranslationResult
Gets the category.- Specified by:
getCategory
in interfaceTranslationResult
- Returns:
- The content category. If this was not specified during the translation call it is defaulted to "general"
-
getSourceString
public java.lang.String getSourceString()
Description copied from interface:TranslationResult
Gets the source string.- Specified by:
getSourceString
in interfaceTranslationResult
- Returns:
- The original source String that was translated.
-
getRating
public int getRating()
Description copied from interface:TranslationResult
Gets the rating.- Specified by:
getRating
in interfaceTranslationResult
- Returns:
- The rating of the returned translation. If unknown this will return -999.
-
getUserId
public java.lang.String getUserId()
Description copied from interface:TranslationResult
Gets the user id.- Specified by:
getUserId
in interfaceTranslationResult
- Returns:
- The ID corresponding to the user who edited the current translation. This might be the user who is currently editing a translation (@see TranslationService.storeTranslation) or the user who edited the currently returned translation (@see TranslationService.translateString). This field might be blank or null depending on the availability of this data.
-
-