src/share/classes/java/util/ResourceBundle.java

Print this page

        

@@ -309,10 +309,37 @@
      * Queue for reference objects referring to class loaders or bundles.
      */
     private static final ReferenceQueue<Object> referenceQueue = new ReferenceQueue<>();
 
     /**
+     * Returns the base name of this bundle, if known.
+     *
+     * This is the value of the {@code baseName} parameter that was passed to
+     * the {@code ResourceBundle.getBundle(...)} method  when the resource
+     * bundle was loaded.
+     *
+     * <p><b>Note:</b>The <code>baseName</code> should be a fully
+     * qualified class name. However, for compatibility with earlier versions,
+     * Sun's Java SE Runtime Environments do not verify this, and so it is
+     * possible to access <code>PropertyResourceBundle</code>s by specifying a
+     * path name (using "/") instead of a fully qualified class name (using
+     * "."). It is possible that this method will return such a pathName if
+     * that is what was given to the {@code ResourceBundle.getBundle(...)}
+     * method when the resource bundle was loaded.
+     *
+     * @return The base name of the resource bundle, a fully qualified
+     *         class name. May be null if the resource
+     *         bundle was not loaded through one of the
+     *         {@code ResourceBundle.getBundle(...)} methods.
+     *
+     * @since 1.8
+     */
+    public String getBaseBundleName() {
+        return name;
+    }
+
+    /**
      * The parent bundle of this bundle.
      * The parent bundle is searched by {@link #getObject getObject}
      * when this bundle does not contain a particular resource.
      */
     protected ResourceBundle parent = null;