Class Translation
java.lang.Object
io.leandev.appfuse.nls.Translation
A translation container that stores key-value pairs for internationalization.
Keys are case-insensitive and automatically converted to lowercase.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all translations.booleancontainsKey(String key) Returns true if this translation contains a mapping for the specified key.Retrieves a translation for the given key.booleanisEmpty()Returns true if this translation contains no key-value mappings.keySet()Returns a set view of the keys contained in this translation.Stores a translation with the given key and value.Removes the translation for the given key.intsize()Returns the number of translations.
-
Constructor Details
-
Translation
public Translation()
-
-
Method Details
-
put
Stores a translation with the given key and value. The key is automatically converted to lowercase. This method is annotated with @JsonAnySetter to allow Jackson to deserialize JSON properties into the translations map.- Parameters:
key- the translation key (will be converted to lowercase)value- the translation value- Returns:
- the previous value associated with the key, or null if there was no mapping
-
get
-
remove
-
containsKey
Returns true if this translation contains a mapping for the specified key.- Parameters:
key- the translation key- Returns:
- true if a translation exists for the key
-
size
public int size()Returns the number of translations.- Returns:
- the number of key-value mappings
-
isEmpty
public boolean isEmpty()Returns true if this translation contains no key-value mappings.- Returns:
- true if this translation is empty
-
keySet
-
clear
public void clear()Removes all translations.
-