Class 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
    • Constructor Summary

      Constructors 
      Constructor Description
      Messages​(java.lang.String bundleName)
      Constructor using default Locale (FRENCH)
      Messages​(java.lang.String bundleName, java.util.Locale locale)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.String key)
      Determines whether the given key is contained in this ResourceBundle or its parent bundles.
      java.util.Map<java.lang.String,​java.lang.String> getAllMessages()
      Retrieve all the messages
      java.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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_LOCALE

        public static final java.util.Locale DEFAULT_LOCALE
        Default Locale
    • 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 name
        locale - 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 message
        args - 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 message
        args - 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 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:
        java.lang.NullPointerException - if key is null