@Entity(name="messages_localized_string") public class LocalizedString extends Object
Constructor and Description |
---|
LocalizedString()
Default constructor.
|
LocalizedString(List<String> selectors,
Map<TextLanguage,String> textMap)
Constructor without the id.
|
LocalizedString(Long id,
List<String> selectors,
Map<TextLanguage,String> textMap)
Full constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addSelector(String selector)
Add a selector to this localized string.
|
boolean |
equals(Object obj)
Equals based on id.
|
String |
from(TextLanguage language)
Get the text content for a specific language.
|
Long |
getId()
Get id.
|
List<String> |
getSelectors()
Get selectors.
|
Map<TextLanguage,String> |
getTextMap()
Get textMap.
|
int |
hashCode()
Hashcode based on id.
|
boolean |
isDefinedFor(TextLanguage language)
Is this localized string defined for a language ? The textMap should
have a value for this language.
|
boolean |
isDefinedForAllLanguages()
Is this localized string defined for all languages ? The textMap
should have values for every TextLanguage.
|
boolean |
isForSelector(String selector)
Is this localized string used for a selector ? The list of selectors
should contain the selector.
|
boolean |
isNonEmptyFor(TextLanguage language)
Is this localized string defined and a non null non empty string for a
language ? The textMap should have a value for this language.
|
boolean |
isNonEmptyForAllLanguages()
Is this localized string defined and a non null non empty string for
all languages ? The textMap should have values for every TextLanguage.
|
boolean |
removeSelector(String selector)
Remove a selector from this localized string.
|
void |
setId(Long id)
Set id.
|
void |
setSelectors(List<String> selectors)
Set selectors.
|
void |
setTextMap(Map<TextLanguage,String> textMap)
Set textMap.
|
String |
toString()
To String method.
|
String |
translateIn(TextLanguage language,
String text)
Translates this string in a specific language.
|
public LocalizedString()
public LocalizedString(Long id, List<String> selectors, Map<TextLanguage,String> textMap)
id
- the idselectors
- the selectorstextMap
- the textMappublic LocalizedString(List<String> selectors, Map<TextLanguage,String> textMap)
selectors
- the selectorstextMap
- the textMappublic boolean isDefinedForAllLanguages()
public boolean isDefinedFor(TextLanguage language)
language
- the language to look atpublic boolean isNonEmptyForAllLanguages()
public boolean isNonEmptyFor(TextLanguage language)
language
- the language to look atpublic boolean isForSelector(String selector)
selector
- the selector to testpublic void addSelector(String selector)
selector
- the selectorpublic boolean removeSelector(String selector)
selector
- the selectorpublic String from(TextLanguage language)
language
- the languagepublic String translateIn(TextLanguage language, String text)
language
- the languagetext
- the text content in that specific languagepublic Long getId()
public void setId(Long id)
id
- the id to setpublic void setSelectors(List<String> selectors)
selectors
- the selectors to setpublic Map<TextLanguage,String> getTextMap()
public void setTextMap(Map<TextLanguage,String> textMap)
textMap
- the textMap to setCopyright © 2023. All rights reserved.