Class MultilingualText
java.lang.Object
com.aquima.interactions.foundation.text.MultilingualText
- All Implemented Interfaces:
IMultilingualText
,Serializable
This implementation of IMultilingualText can be used to get the same String value returned independent of the
language. In addition this object can contain different texts for different languages.
- Since:
- 6.4
- Author:
- F. van der Meer, J. van Leuven
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty multilingual text object without a default value.MultilingualText
(String defaultText) Create a new MultiLanguageText object with the specified id. -
Method Summary
Modifier and TypeMethodDescriptionaddContent
(String code, String text) Add a new translation to this MultiLanguageText.boolean
Returns the default text.String[]
Retrieves the language codes.Retrieves the text for the specified language code.Retrieves the text for the specified language code.int
hashCode()
void
setDefaultText
(String defaultText) Sets the default text.toString()
-
Constructor Details
-
MultilingualText
public MultilingualText()Creates a new empty multilingual text object without a default value. -
MultilingualText
Create a new MultiLanguageText object with the specified id.- Parameters:
defaultText
- The default text that should be used when no text can be found for a specific language (optional).
-
-
Method Details
-
addContent
Add a new translation to this MultiLanguageText.- Parameters:
code
- the language code of the added text.text
- The actual text- Returns:
- This pointer to allow method chaining.
-
getLanguageCodes
Description copied from interface:IMultilingualText
Retrieves the language codes.- Specified by:
getLanguageCodes
in interfaceIMultilingualText
- Returns:
- The text, can't return null.
-
getValue
-
getValue
-
getValue
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 interfaceIMultilingualText
- Parameters:
languageCode
- never null- Returns:
- The text, can return a null pointer.
-
getValue
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 interfaceIMultilingualText
- Parameters:
languageCode
- never nullfallbackLanguageCode
- never null- Returns:
- The text, can return a null pointer.
-
equals
-
hashCode
public int hashCode() -
toString
-
getDefaultText
Description copied from interface:IMultilingualText
Returns the default text.- Specified by:
getDefaultText
in interfaceIMultilingualText
- Returns:
- The default text, can be null.
-
setDefaultText
Sets the default text.- Parameters:
defaultText
- The default text.
-