Package fr.gouv.vitam.common.i18n
Class Messages
- java.lang.Object
-
- fr.gouv.vitam.common.i18n.Messages
-
public class Messages extends java.lang.Object
Internationalization Messages support
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Locale
DEFAULT_LOCALE
Default Locale
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(java.lang.String key)
Determines whether the givenkey
is contained in thisResourceBundle
or its parent bundles.java.util.Map<java.lang.String,java.lang.String>
getAllMessages()
Retrieve all the messagesjava.util.Locale
getLocale()
java.lang.String
getString(java.lang.String key)
java.lang.String
getString(java.lang.String key, java.lang.Object... args)
java.lang.String
getStringNotEmpty(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 givenkey
is contained in thisResourceBundle
or its parent bundles.- Parameters:
key
- the resourcekey
- Returns:
true
if the givenkey
is contained in thisResourceBundle
or its parent bundles;false
otherwise.- Throws:
java.lang.NullPointerException
- ifkey
isnull
-
-