Package org.silverpeas.core.ui
Class UserI18NTranslationMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,String>
-
- org.silverpeas.core.ui.UserI18NTranslationMap
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,String>
public class UserI18NTranslationMap extends HashMap<String,String>
This map is dedicated to simple translation management around user languages.- Author:
- silveryocha
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description UserI18NTranslationMap()
UserI18NTranslationMap(Map<String,String> other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(Object language)
String
get(Object language)
Gets the translation corresponding to given language.String
put(String language, String translation)
Puts a translation for a language.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Method Detail
-
containsKey
public boolean containsKey(Object language)
- Specified by:
containsKey
in interfaceMap<String,String>
- Overrides:
containsKey
in classHashMap<String,String>
-
get
public String get(Object language)
Gets the translation corresponding to given language.If it does not exist a translation for the given language, then a default one is retrieved by checking translation existence of handled languages. In a such case, the first existing translation is considered as default.
If default translation is not needed, then check availability with
containsKey(Object)
before.- Specified by:
get
in interfaceMap<String,String>
- Overrides:
get
in classHashMap<String,String>
- Parameters:
language
- instance representing the language.- Returns:
- a string corresponding to the translation of given language, or a default translation if none. Empty string if it does not exist at least one translation.
-
put
public String put(String language, String translation)
Puts a translation for a language.If the translation is not defined, then the language translation entry is removed.
- Specified by:
put
in interfaceMap<String,String>
- Overrides:
put
in classHashMap<String,String>
- Parameters:
language
- key with which the specified value is to be associatedtranslation
- value to be associated with the specified key- Returns:
- the resulting of
Map.put(Object, Object)
if translation is defined, or the resulting ofMap.remove(Object)
otherwise.
-
-