View Javadoc
1   package com.atlassian.refapp.sal.message;
2   
3   import java.util.Locale;
4   import java.util.ResourceBundle;
5   
6   /**
7    * Encapsulates a strategy for looking up a {@link ResourceBundle} from a {@link ClassLoader} given the bundle name
8    * and a locale.
9    *
10   * <b>NOTE:</b> This is not part of the public SAL API, but an internal interface used by the reference implementation,
11   * primarily to allow {@link ResourceBundle#getBundle(String, java.util.Locale, ClassLoader)} to be mocked in tests.
12   *
13   * @since 2.0
14   */
15  interface ResourceBundleResolver {
16      /**
17       * Gets a resource bundle using the specified base name, locale, and class loader.  This obeys the same general
18       * contract as {@link ResourceBundle#getBundle(String, java.util.Locale, ClassLoader)}.
19       *
20       * @param baseName    the base name of the resource bundle, a fully qualified class name
21       * @param locale      the locale for which a resource bundle is desired
22       * @param classLoader the class loader from which to load the resource bundle
23       * @return a resource bundle for the given base name and locale
24       * @throws NullPointerException               if {@code baseName}, {@code locale}, or {@code loader} is {@code null}
25       * @throws java.util.MissingResourceException if no resource bundle for the specified base name can be found
26       * @see ResourceBundle#getBundle(String, java.util.Locale, ClassLoader)
27       */
28      ResourceBundle getBundle(String baseName, Locale locale, ClassLoader classLoader);
29  }