Class CompositeMultilingualText

java.lang.Object
com.aquima.interactions.foundation.text.CompositeMultilingualText
All Implemented Interfaces:
IMultilingualText, Serializable

public class CompositeMultilingualText extends Object implements IMultilingualText

This implementation of IMultilingualText can be used to combine multiple multilingual texts with a specified seperator.

Examples (where "a","b","c" are texts for a specific language):

  • ["a", "b", "c"] with seperator , => "a,b,c"
  • ["a", "", "c"] with seperator , => "a,c"
  • ["a", " ", "c"] with seperator , => "a,c"
  • ["a", "b", " "] with seperator , => "a,b"
  • ["", "b", " "] with seperator , => "b"
Since:
7.1
Author:
J. van Leuven
See Also:
  • Constructor Details

    • CompositeMultilingualText

      public CompositeMultilingualText(IMultilingualText text1, IMultilingualText text2, String seperator)
      Construct a composite multilingual text with two texts.
      Parameters:
      text1 - First text, may not be null
      text2 - Second text, may not be null
      seperator - Seperator, may not be null
    • CompositeMultilingualText

      public CompositeMultilingualText(IMultilingualText[] texts, String seperator)
      Construct a composite multilingual text with multiple texts.
      Parameters:
      texts - Array of texts, may not be null, an empty array or contain null objects.
      seperator - Seperator, may not be null
  • Method Details

    • getValue

      public String getValue(ILanguage language)
    • getValue

      public String getValue(ILanguage language, ILanguage fallbackLanguage)
    • getValue

      public String getValue(String languageCode)
      Description copied from interface: IMultilingualText
      Retrieves the text for the specified language code. If desired one can return a constant text independent of language code.
      Specified by:
      getValue in interface IMultilingualText
      Parameters:
      languageCode - never null
      Returns:
      The text, can return a null pointer.
    • getValue

      public String getValue(String languageCode, String fallbackLanguageCode)
      Description copied from interface: IMultilingualText
      Retrieves the text for the specified language code. If this text does not exist, the text of the fallback language code is being retrieved. If desired one can return a constant text independent of language code.
      Specified by:
      getValue in interface IMultilingualText
      Parameters:
      languageCode - never null
      fallbackLanguageCode - never null
      Returns:
      The text, can return a null pointer.
    • hashCode

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

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

      public String[] getLanguageCodes()
      Description copied from interface: IMultilingualText
      Retrieves the language codes.
      Specified by:
      getLanguageCodes in interface IMultilingualText
      Returns:
      The text, can't return null.
    • getDefaultText

      public String getDefaultText()
      Description copied from interface: IMultilingualText
      Returns the default text.
      Specified by:
      getDefaultText in interface IMultilingualText
      Returns:
      The default text, can be null.