Class TranslationQueryEntity

java.lang.Object
com.e1c.langtool.external.cache.TranslationQueryEntity
All Implemented Interfaces:
Serializable

public final class TranslationQueryEntity extends Object implements Serializable
This class encapsulates the translation query.

In contrast to TranslationQuery it contains an id of external translation services provider. This is in order to know which provider translated this query. Due to this information it's easy to store and cache translations. Also it doesn't have information about name processing.

See Also:
  • Constructor Details

    • TranslationQueryEntity

      public TranslationQueryEntity(String providerId, String sourceLanguage, String targetLanguage, String text)
      Creates a new translation query.
      Parameters:
      providerId - the id of provider that translating this query
      sourceLanguage - the language to translate from
      targetLanguage - the language to translate to
      text - the text to translate
  • Method Details

    • fromQuery

      public static TranslationQueryEntity fromQuery(ISingleTranslationQuery query, String providerId)
      Creates a new translation query entity from ISingleTranslationQuery.
      Parameters:
      query - the translation query
      providerId - the id of provider that translating this query
      Returns:
      translation query entity
      See Also:
    • getProviderId

      public String getProviderId()
      Returns provider's id.
      Returns:
      provider's id
    • getSourceLanguage

      public String getSourceLanguage()
      Returns the source language of translated text.
      Returns:
      the source language of translated text
    • getTargetLanguage

      public String getTargetLanguage()
      Returns the target language to translate.
      Returns:
      the target language to translate
    • getText

      public String getText()
      Returns the text to translate.
      Returns:
      the text to translate
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object