Class Messages

java.lang.Object
fr.gouv.vitam.common.i18n.Messages

public class Messages extends Object
Internationalization Messages support
  • Field Details

    • DEFAULT_LOCALE

      public static final Locale DEFAULT_LOCALE
      Default Locale
  • Constructor Details

    • Messages

      public Messages(String bundleName)
      Constructor using default Locale (FRENCH)
      Parameters:
      bundleName - the bundle name
    • Messages

      public Messages(String bundleName, Locale locale)
      Constructor
      Parameters:
      bundleName - the bundle name
      locale - the Local object
  • Method Details

    • getAllMessages

      public Map<String,String> getAllMessages()
      Retrieve all the messages
      Returns:
      map of messages
    • getString

      public final String getString(String key)
      Parameters:
      key - the key of the message
      Returns:
      the associated message
    • getString

      public final String getString(String key, Object... args)
      Parameters:
      key - the key of the message
      args - the arguments to use as MessageFormat.format(mesg, args)
      Returns:
      the associated message
    • getStringNotEmpty

      public final String getStringNotEmpty(String key, Object... args)
      Parameters:
      key - the key of the message
      args - the arguments to use as MessageFormat.format(mesg, args)
      Returns:
      the associated message, !key! if value is null or empty
    • getLocale

      public Locale getLocale()
      Returns:
      the current Locale
    • containsKey

      public boolean containsKey(String key)
      Determines whether the given key is contained in this ResourceBundle or its parent bundles.
      Parameters:
      key - the resource key
      Returns:
      true if the given key is contained in this ResourceBundle or its parent bundles; false otherwise.
      Throws:
      NullPointerException - if key is null