Class DefaultBundleFactory

  • All Implemented Interfaces:
    BundleFactory

    public class DefaultBundleFactory
    extends Object
    implements BundleFactory
    Default implementation of a bundle factory.

    Works for modular and non-modular applications.

    Author:
    harald
    • Constructor Detail

      • DefaultBundleFactory

        public DefaultBundleFactory()
        Creates the bundle factory.
    • Method Detail

      • getControl

        public ResourceBundle.Control getControl​(String baseName)
        Description copied from interface: BundleFactory
        Gets the control to load the bundle.
        Specified by:
        getControl in interface BundleFactory
        Parameters:
        baseName - the bundle basename
        Returns:
        the control, null if delegate to ResourceBundle's default
      • findBundle

        public ResourceBundle findBundle​(String baseName,
                                         Locale locale)
        Description copied from interface: BundleFactory
        Finds a resource bundle using the specified base name and locale, and the caller's class loader.
        Specified by:
        findBundle in interface BundleFactory
        Parameters:
        baseName - the base name of the resource bundle, a fully qualified class name
        locale - the locale for which a resource bundle is desired
        Returns:
        a resource bundle for the given base name and locale
      • findBundle

        public ResourceBundle findBundle​(String baseName,
                                         Locale locale,
                                         ClassLoader loader)
        Description copied from interface: BundleFactory
        Finds a resource bundle using the specified base name, locale, and class loader.
        Specified by:
        findBundle in interface BundleFactory
        Parameters:
        baseName - the base name of the resource bundle, a fully qualified class name
        locale - the locale for which a resource bundle is desired
        loader - the class loader from which to load the resource bundle
        Returns:
        a resource bundle for the given base name and locale
      • getBundle

        protected ResourceBundle getBundle​(BundleSupport support,
                                           Locale locale)
        Gets the bundle from the corresponding module according to the bundle support.
        Parameters:
        support - the bundle support
        locale - the locale
        Returns:
        the bundle
      • createProviders

        protected List<ResourceBundleControlProvider> createProviders()
        Creates a list of providers.
        Returns:
        the non-empty list of providers, null if no providers found
      • normalizeBasename

        protected String normalizeBasename​(String baseName)
        Normalizes the basename.
        The name is usually a dotted classname or a slashed resourcename without a leading slash.
        Parameters:
        baseName - the name
        Returns:
        the normalized name