Class ParameterizedMultilingualText

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

public class ParameterizedMultilingualText extends Object implements IMultilingualText
Parameterized multilingual text. It inserts parameters in the message output on the getValue. A text containing:
 'abc {0}{1}{2}' with new String[] { "a", "b", "c", "d" } => 'abc abc'
 'abc {0}{1}{2}' with new String[] { "a", "b", "c" }      => 'abc abc'
 'abc {0}{1}{2}' with new String[] { "a", "b" }           => 'abc ab{2}'
 
Since:
5.0
Author:
F. van der Meer
See Also:
  • Constructor Details

    • ParameterizedMultilingualText

      public ParameterizedMultilingualText(IMultilingualText delegateText, String[] parameters)
      Constructs the text object with the text and the parameters that should be used.
      Parameters:
      delegateText - The text object containing the parameter markers.
      parameters - The parameter values that should be replaced in the text.
  • 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.