Skip to content

Commit fca41d7

Browse files
hansonrhansonr
authored andcommitted
Implements Java8 getBaseName()
1 parent 867eb43 commit fca41d7

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

sources/net.sf.j2s.java.core/src/java/util/ResourceBundle.java

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,30 @@ public String toString() {
343343
*/
344344
private Locale locale = null;
345345

346-
// /**
347-
// * The base bundle name for this bundle.
348-
// */
349-
// private String name;
350-
351-
/**
346+
/**
347+
* The base bundle name for this bundle.
348+
*/
349+
private String name;
350+
351+
/**
352+
* Returns the base name of this bundle, if known, or {@code null} if unknown.
353+
*
354+
* If not null, then this is the value of the {@code baseName} parameter
355+
* that was passed to the {@code ResourceBundle.getBundle(...)} method
356+
* when the resource bundle was loaded.
357+
*
358+
* @return The base name of the resource bundle, as provided to and expected
359+
* by the {@code ResourceBundle.getBundle(...)} methods.
360+
*
361+
* @see #getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
362+
*
363+
* @since 1.8
364+
*/
365+
public String getBaseBundleName() {
366+
return name;
367+
}
368+
369+
/**
352370
* The flag indicating this bundle has expired in the cache.
353371
*/
354372
private volatile boolean expired;
@@ -1475,7 +1493,7 @@ private static final ResourceBundle loadBundle(CacheKey cacheKey, List<String> f
14751493
// Set the format in the cache key so that it can be
14761494
// used when calling needsReload later.
14771495
cacheKey.setFormat(format);
1478-
// bundle.name = cacheKey.getName();
1496+
bundle.name = cacheKey.getName();
14791497
bundle.locale = targetLocale;
14801498
// Bundle provider might reuse instances. So we should make
14811499
// sure to clear the expired flag here.

0 commit comments

Comments
 (0)