Class SingleLocaleMultiResourceBundle

  • All Implemented Interfaces:
    MultiResourceBundle

    public class SingleLocaleMultiResourceBundle
    extends java.util.ResourceBundle
    implements MultiResourceBundle
    Extension of a simple resource bundle able to load, and work with multiple message resource files.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.ResourceBundle

        java.util.ResourceBundle.Control
    • Field Summary

      • Fields inherited from class java.util.ResourceBundle

        parent
    • Constructor Summary

      Constructors 
      Constructor Description
      SingleLocaleMultiResourceBundle​(@NotNull java.util.Locale locale)
      Creates an instance of this class without reading any message resource files.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull MultiResourceBundle addMessageSources​(@Nullable java.lang.String... fileLocations)
      Add message sources into multiple resource bundle.
      @NotNull java.util.Enumeration<java.lang.String> getKeys()
      Returns an enumeration of the keys.
      @NotNull java.util.Locale getLocale()  
      protected @Nullable java.lang.Object handleGetObject​(@NotNull java.lang.String key)
      Gets an object for the given key from this resource bundle.
      • Methods inherited from class java.util.ResourceBundle

        clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getObject, getString, getStringArray, handleKeySet, keySet, setParent
      • Methods inherited from class java.lang.Object

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

      • SingleLocaleMultiResourceBundle

        public SingleLocaleMultiResourceBundle​(@NotNull
                                               @NotNull java.util.Locale locale)
        Creates an instance of this class without reading any message resource files.
        Parameters:
        locale - A locale of this resource bundle.
    • Method Detail

      • addMessageSources

        @NotNull
        public @NotNull MultiResourceBundle addMessageSources​(@Nullable
                                                              @Nullable java.lang.String... fileLocations)
        Description copied from interface: MultiResourceBundle
        Add message sources into multiple resource bundle.
        Specified by:
        addMessageSources in interface MultiResourceBundle
        Parameters:
        fileLocations - Resource bundles locations.
        Returns:
        Returns current resource bundle with all previously added resource bundles.
      • getLocale

        @NotNull
        public @NotNull java.util.Locale getLocale()
        Overrides:
        getLocale in class java.util.ResourceBundle
      • handleGetObject

        @Nullable
        protected @Nullable java.lang.Object handleGetObject​(@NotNull
                                                             @NotNull java.lang.String key)
        Gets an object for the given key from this resource bundle. Returns null if this resource bundle does not contain an object for the given key. In the case multiple files has contained the same key, there is no guarantee of what message will be returned.
        Specified by:
        handleGetObject in class java.util.ResourceBundle
        Parameters:
        key - The key for the desired object.
        Returns:
        The object for the given key, or null.
        Throws:
        java.lang.NullPointerException - If key is null.
      • getKeys

        @NotNull
        public @NotNull java.util.Enumeration<java.lang.String> getKeys()
        Returns an enumeration of the keys.
        Specified by:
        getKeys in class java.util.ResourceBundle
        Returns:
        An @{code Enumeration} of the keys contained in this @{code ResourceBundle} and its parent bundles.