Class ResBundleMessages

  • All Implemented Interfaces:
    Messages, Iterable<String>

    public class ResBundleMessages
    extends Object
    implements Messages
    Simple class providing messages from a specific resource bundle.
    • Method Detail

      • getLocale

        public Locale getLocale()
        Description copied from interface: Messages
        Gets the intended locale of the messages which is also used for MessageFormat.
        Specified by:
        getLocale in interface Messages
        Returns:
        The intended locale of the messages .
      • getActualLocale

        public Locale getActualLocale()
        Description copied from interface: Messages
        Gets the actual locale of this messages. This may be a fallback of the intended locale.
        Specified by:
        getActualLocale in interface Messages
        Returns:
        The actual locale of the messages .
      • containsKey

        public boolean containsKey​(String key)
        Description copied from interface: Messages
        Gets whether this Messages contains the designated key.
        Specified by:
        containsKey in interface Messages
        Parameters:
        key - The key to check whether it exists in this Messages.
        Returns:
        Whether this Messages contains the designated key.
      • getString

        public String getString​(String key,
                                Object... args)
        Description copied from interface: Messages
        Gets the string for the designated key formatted using String.format(String, Object...). If the key is not known, the key itself will be returned instead of throwing a MissingResoucreException.
        Specified by:
        getString in interface Messages
        Parameters:
        key - The key of the localised string.
        args - The arguments for String.format(String, Object...). If this is null or an empty array, formatting will be skipped.
        Returns:
        The formatted string message for the designated key.
      • getFormattedString

        public String getFormattedString​(String key,
                                         Object... args)
        Description copied from interface: Messages
        Gets the string for the designated key formatted using Format.format(Object). If the key is not known, the key itself will be returned instead of throwing a MissingResoucreException.
        Specified by:
        getFormattedString in interface Messages
        Parameters:
        key - The key of the localised string.
        args - The arguments for Format.format(Object).
        Returns:
        The formatted string message for the designated key.