Class Messages


  • public class Messages
    extends java.lang.Object
    Class to handle localized messages.
    Author:
    Christopher Mindus
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String format​(java.lang.String key, java.lang.Object... objects)
      Gets the localized string from a resource bundle.
      static java.lang.String format​(java.lang.String key, java.lang.String defaultMessage, java.lang.Object... objects)
      Gets the localized string from a resource bundle.
      static java.lang.String getString​(java.lang.String key)
      Gets the localized string from a resource bundle.
      static java.lang.String getString​(java.lang.String key, java.lang.String defaultMessage)
      Gets the localized string from a resource bundle.
      • Methods inherited from class java.lang.Object

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

      • getString

        public static java.lang.String getString​(java.lang.String key)
        Gets the localized string from a resource bundle.
        Parameters:
        key - The key for the localized message.
        Returns:
        The string matching a key.
      • getString

        public static java.lang.String getString​(java.lang.String key,
                                                 java.lang.String defaultMessage)
        Gets the localized string from a resource bundle.
        Parameters:
        key - The key for the localized message.
        defaultMessage - The default message to use, or null for none.
        Returns:
        The string matching a key.
      • format

        public static java.lang.String format​(java.lang.String key,
                                              java.lang.Object... objects)
        Gets the localized string from a resource bundle. The string in the resource bundle should have the "printf"-style formatting for the "objects" parameter(s).
        Parameters:
        key - The key for the localized message.
        objects - The parameters.
        Returns:
        The string matching a key.
      • format

        public static java.lang.String format​(java.lang.String key,
                                              java.lang.String defaultMessage,
                                              java.lang.Object... objects)
        Gets the localized string from a resource bundle. The string in the resource bundle should have the "printf"-style formatting for the "objects" parameter(s).
        Parameters:
        key - The key for the localized message.
        defaultMessage - The default message to use, or null for none.
        objects - The parameters.
        Returns:
        The string matching a key.