Package fr.gouv.vitam.common.i18n
Class Messages
- java.lang.Object
-
- fr.gouv.vitam.common.i18n.Messages
-
public class Messages extends java.lang.ObjectInternationalization Messages support
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.LocaleDEFAULT_LOCALEDefault Locale
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(java.lang.String key)Determines whether the givenkeyis contained in thisResourceBundleor its parent bundles.java.util.Map<java.lang.String,java.lang.String>getAllMessages()Retrieve all the messagesjava.util.LocalegetLocale()java.lang.StringgetString(java.lang.String key)java.lang.StringgetString(java.lang.String key, java.lang.Object... args)java.lang.StringgetStringNotEmpty(java.lang.String key, java.lang.Object... args)
-
-
-
Constructor Detail
-
Messages
public Messages(java.lang.String bundleName)
Constructor using default Locale (FRENCH)- Parameters:
bundleName- the bundle name
-
Messages
public Messages(java.lang.String bundleName, java.util.Locale locale)Constructor- Parameters:
bundleName- the bundle namelocale- the Local object
-
-
Method Detail
-
getAllMessages
public java.util.Map<java.lang.String,java.lang.String> getAllMessages()
Retrieve all the messages- Returns:
- map of messages
-
getString
public final java.lang.String getString(java.lang.String key)
- Parameters:
key- the key of the message- Returns:
- the associated message
-
getString
public final java.lang.String getString(java.lang.String key, java.lang.Object... args)- Parameters:
key- the key of the messageargs- the arguments to use as MessageFormat.format(mesg, args)- Returns:
- the associated message
-
getStringNotEmpty
public final java.lang.String getStringNotEmpty(java.lang.String key, java.lang.Object... args)- Parameters:
key- the key of the messageargs- the arguments to use as MessageFormat.format(mesg, args)- Returns:
- the associated message, !key! if value is null or empty
-
getLocale
public java.util.Locale getLocale()
- Returns:
- the current Locale
-
containsKey
public boolean containsKey(java.lang.String key)
Determines whether the givenkeyis contained in thisResourceBundleor its parent bundles.- Parameters:
key- the resourcekey- Returns:
trueif the givenkeyis contained in thisResourceBundleor its parent bundles;falseotherwise.- Throws:
java.lang.NullPointerException- ifkeyisnull
-
-