< prev index next >
src/java.base/share/classes/java/util/ResourceBundle.java
Print this page
@@ -214,11 +214,11 @@
* will locate resource bundles in the caller's module (<em>caller module</em>).</li>
* <li>If resource bundles are deployed in named modules separate from
* the caller module, those resource bundles need to be loaded from service
* providers of {@link ResourceBundleProvider}. The caller module must declare
* "{@code uses}" and the service interface name is the concatenation of the
- * package name of the base name, string "(@code .spi.}, the simple class
+ * package name of the base name, string "{@code .spi.}", the simple class
* name of the base name, and the string "{@code Provider}". The
* <em>bundle provider modules</em> containing resource bundles must
* declare "{@code provides}" with the service interface name and
* its implementation class name. For example, if the base name is
* "{@code com.example.app.MyResources}", the caller module must declare
@@ -242,11 +242,12 @@
*
* <h3><a id="RBP_support">ResourceBundleProvider Service Providers</a></h3>
*
* The {@code getBundle} factory methods load service providers of
* {@link ResourceBundleProvider}, if available, using {@link ServiceLoader}.
- * The service type is designated by {@code package name + ".spi." + simple name +"Provider"}. For
+ * The service type is designated by
+ * {@code <package name> + ".spi." + <simple name> + "Provider"}. For
* example, if the base name is "{@code com.example.app.MyResources}", the service
* type is {@code com.example.app.spi.MyResourcesProvider}.
* <p>
* In named modules, the loaded service providers for the given base name are
* used to load resource bundles. If no service provider is available, or if
@@ -922,11 +923,16 @@
* </blockquote>
*
* <p> Resource bundles in named modules may be encapsulated. When
* the resource bundle is loaded from a provider, the caller module
* must have an appropriate <i>uses</i> clause in its <i>module descriptor</i>
- * to declare that the module uses implementations of {@code "baseName"Provider}.
+ * to declare that the module uses implementations of
+ * {@code <package name> + ".spi." + <simple name> + "Provider"}.
+ * Otherwise, it will load the resource bundles that are local in the
+ * given module or that are visible to the class loader of the given module
+ * (refer to the <a href="#bundleprovider">Resource Bundles in Named Modules</a>
+ * section for details).
* When the resource bundle is loaded from the specified module, it is
* subject to the encapsulation rules specified by
* {@link Module#getResourceAsStream Module.getResourceAsStream}.
*
* @param baseName the base name of the resource bundle,
@@ -957,24 +963,21 @@
* on behalf of the specified module.
*
* <p> Resource bundles in named modules may be encapsulated. When
* the resource bundle is loaded from a provider, the caller module
* must have an appropriate <i>uses</i> clause in its <i>module descriptor</i>
- * to declare that the module uses implementations of {@code "baseName"Provider}.
+ * to declare that the module uses implementations of
+ * {@code <package name> + ".spi." + <simple name> + "Provider"}.
+ * Otherwise, it will load the resource bundles that are local in the
+ * given module or that are visible to the class loader of the given module
+ * (refer to the <a href="#bundleprovider">Resource Bundles in Named Modules</a>
+ * section for details).
* When the resource bundle is loaded from the specified module, it is
* subject to the encapsulation rules specified by
* {@link Module#getResourceAsStream Module.getResourceAsStream}.
*
* <p>
- * If the given {@code module} is a named module, this method will
- * load the service providers for {@link java.util.spi.ResourceBundleProvider}
- * and also resource bundles that are local in the given module or that
- * are visible to the class loader of the given module (refer to the
- * <a href="#bundleprovider">Resource Bundles in Named Modules</a> section
- * for details).
- *
- * <p>
* If the given {@code module} is an unnamed module, then this method is
* equivalent to calling {@link #getBundle(String, Locale, ClassLoader)
* getBundle(baseName, targetLocale, module.getClassLoader()} to load
* resource bundles that are visible to the class loader of the given
* unnamed module. Custom {@link java.util.spi.ResourceBundleControlProvider}
@@ -1069,12 +1072,14 @@
*
* <p>
* Resource bundles in a named module are private to that module. If
* the caller is in a named module, this method will find resource bundles
* from the service providers of {@link java.util.spi.ResourceBundleProvider}
- * and also find resource bundles that are in the caller's module or
- * that are visible to the given class loader.
+ * if any. Otherwise, it will load the resource bundles that are visible to
+ * the given {@code loader} (refer to the
+ * <a href="#bundleprovider">Resource Bundles in Named Modules</a> section
+ * for details).
* If the caller is in a named module and the given {@code loader} is
* different than the caller's class loader, or if the caller is not in
* a named module, this method will not find resource bundles from named
* modules.
*
< prev index next >