Class R


  • public final class R
    extends java.lang.Object
    Utility class to retrieve messages from ResourceBundles.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String get​(java.lang.String key, java.lang.Object... values)
      Gets a translated message.
      static void setBundle​(java.util.ResourceBundle resourceBundle)
      Programmatically set the ResourceBundle to be used.
      static void setUseNeutralMessages​(boolean useNeutral)
      If set to true, messages will not be obtained from resource bundles but formatted as key:param1:...:paramN.
      • Methods inherited from class java.lang.Object

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

      • setBundle

        public static void setBundle​(java.util.ResourceBundle resourceBundle)
        Programmatically set the ResourceBundle to be used.
        Parameters:
        resourceBundle - the bundle to be used.
      • setUseNeutralMessages

        public static void setUseNeutralMessages​(boolean useNeutral)
        If set to true, messages will not be obtained from resource bundles but formatted as key:param1:...:paramN.
        Parameters:
        useNeutral - true to use neutral messages, false otherwise
      • get

        public static java.lang.String get​(java.lang.String key,
                                           java.lang.Object... values)
        Gets a translated message.
        Parameters:
        key - The message key to retrieve.
        values - The values that fill placeholders in the message.
        Returns:
        The formatted message.