Modifier and Type | Class and Description |
---|---|
private static class | Bundles.BundleReference
References to bundles are soft references so that they can be garbage collected when they have no hard references. |
private static class | Bundles.CacheKey
Key used for cached resource bundles. |
private static interface | Bundles.CacheKeyReference
The common interface to get a CacheKey in LoaderReference and BundleReference. |
public static interface | Bundles.Strategy
The Strategy interface defines methods that are called by Bundles.of during the resource bundle loading process. |
Modifier and Type | Field and Description |
---|---|
private static final JavaUtilResourceBundleAccess | |
private static final ConcurrentMap | cacheList
The cache is a map from cache keys (with bundle base name, locale, and class loader) to either a resource bundle or NONEXISTENT_BUNDLE wrapped by a BundleReference. |
private static final int | INITIAL_CACHE_SIZE
initial size of the bundle cache |
private static final ResourceBundle | NONEXISTENT_BUNDLE
constant indicating that no resource bundle exists |
private static final ReferenceQueue | referenceQueue
Queue for reference objects referring to class loaders or bundles. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private static void | |
private static ResourceBundle | Returns: the ResourceBundle found in the cache or nullthe key to look up the cache cacheKeyFinds a bundle in the cache. |
private static ResourceBundle | |
private static boolean | |
private static ResourceBundle | loadBundleFromProviders(String baseName, Locale locale, ServiceLoader<ResourceBundleProvider> providers, Bundles.
Loads ResourceBundle from service providers. |
private static ResourceBundle | |
public static ResourceBundle | |
private static ResourceBundle | Returns: the ResourceBundle for the cacheKey; if someone has put the bundle before this call, the one found in the cache is returned.the key for the resource bundle cacheKey,the resource bundle to be put in the cache bundle)Put a new bundle in the cache. |
private static void | throwMissingResourceException(String baseName, Locale locale, Throwable cause)
Throw a MissingResourceException with proper message |
public static String | Returns: the other bundle name, or the same name for non-legacy ISO languagesResourceBundle base name baseName, String ResourceBundle bundle name bundleName, Locale locale locale)Generates the other bundle name for languages that have changed, i.e. "he", "id", and "yi" |
bundleAccess | back to summary |
---|---|
private static final JavaUtilResourceBundleAccess bundleAccess |
cacheList | back to summary |
---|---|
private static final ConcurrentMap<Bundles. The cache is a map from cache keys (with bundle base name, locale, and class loader) to either a resource bundle or NONEXISTENT_BUNDLE wrapped by a BundleReference. The cache is a ConcurrentMap, allowing the cache to be searched concurrently by multiple threads. This will also allow the cache keys to be reclaimed along with the ClassLoaders they reference. This variable would be better named "cache", but we keep the old name for compatibility with some workarounds for bug 4212439. |
INITIAL_CACHE_SIZE | back to summary |
---|---|
private static final int INITIAL_CACHE_SIZE initial size of the bundle cache |
NONEXISTENT_BUNDLE | back to summary |
---|---|
private static final ResourceBundle NONEXISTENT_BUNDLE constant indicating that no resource bundle exists |
referenceQueue | back to summary |
---|---|
private static final ReferenceQueue<Object> referenceQueue Queue for reference objects referring to class loaders or bundles. |
Bundles | back to summary |
---|---|
private Bundles() |
cleanupCache | back to summary |
---|---|
private static void cleanupCache() |
findBundleInCache | back to summary |
---|---|
private static ResourceBundle findBundleInCache(Bundles. Finds a bundle in the cache.
|
findBundleOf | back to summary |
---|---|
private static ResourceBundle findBundleOf(Bundles. |
isValidBundle | back to summary |
---|---|
private static boolean isValidBundle(ResourceBundle bundle) |
loadBundleFromProviders | back to summary |
---|---|
private static ResourceBundle loadBundleFromProviders(String baseName, Locale locale, ServiceLoader<ResourceBundleProvider> providers, Bundles. Loads ResourceBundle from service providers.
|
loadBundleOf | back to summary |
---|---|
private static ResourceBundle loadBundleOf(String baseName, Locale targetLocale, Bundles. |
of | back to summary |
---|---|
public static ResourceBundle of(String baseName, Locale locale, Bundles. |
putBundleInCache | back to summary |
---|---|
private static ResourceBundle putBundleInCache(Bundles. Put a new bundle in the cache.
|
throwMissingResourceException | back to summary |
---|---|
private static void throwMissingResourceException(String baseName, Locale locale, Throwable cause) Throw a MissingResourceException with proper message |
toOtherBundleName | back to summary |
---|---|
public static String toOtherBundleName(String baseName, String bundleName, Locale locale) Generates the other bundle name for languages that have changed, i.e. "he", "id", and "yi" |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public Bundles. |
cacheKey | back to summary |
---|---|
private final Bundles. |
BundleReference | back to summary |
---|---|
pack-priv BundleReference(ResourceBundle referent, ReferenceQueue<Object> q, Bundles. |
getCacheKey | back to summary |
---|---|
public Bundles. Implements sun.
|
Modifier and Type | Field and Description |
---|---|
private Throwable | |
private int | |
private Locale | |
private String | |
private ServiceLoader |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
private void | |
public Object | |
public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
private Throwable | |
pack-priv Locale | |
pack-priv String | |
pack-priv ServiceLoader | |
public int | |
private void | |
pack-priv Bundles. | |
pack-priv Bundles. | |
pack-priv void | |
public String |
cause | back to summary |
---|---|
private Throwable cause |
hashCodeCache | back to summary |
---|---|
private int hashCodeCache |
locale | back to summary |
---|---|
private Locale locale |
name | back to summary |
---|---|
private String name |
providers | back to summary |
---|---|
private ServiceLoader<ResourceBundleProvider> providers |
CacheKey | back to summary |
---|---|
pack-priv CacheKey(String baseName, Locale locale) |
calculateHashCode | back to summary |
---|---|
private void calculateHashCode() |
clone | back to summary |
---|---|
public Object clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true , but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true , this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by |
equals | back to summary |
---|---|
public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. |
getCause | back to summary |
---|---|
private Throwable getCause() |
getLocale | back to summary |
---|---|
pack-priv Locale getLocale() |
getName | back to summary |
---|---|
pack-priv String getName() |
getProviders | back to summary |
---|---|
pack-priv ServiceLoader |
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
|
setCause | back to summary |
---|---|
private void setCause(Throwable cause) |
setLocale | back to summary |
---|---|
pack-priv Bundles. |
setName | back to summary |
---|---|
pack-priv Bundles. |
setProviders | back to summary |
---|---|
pack-priv void setProviders(ServiceLoader<ResourceBundleProvider> providers) |
toString | back to summary |
---|---|
public String toString() Overrides java. Doc from java. Returns a string representation of the object. |
getCacheKey | back to summary |
---|---|
public Bundles. |
Modifier and Type | Method and Description |
---|---|
public List | getCandidateLocales(String baseName, Locale locale)
Returns a list of locales to be looked up for bundle loading. |
public Class | getResourceBundleProviderType(String baseName, Locale locale)
Returns the service provider type for the given baseName and locale, or null if no service providers should be used. |
public String | toBundleName(String baseName, Locale locale)
Returns the bundle name for the given baseName and locale. |
getCandidateLocales | back to summary |
---|---|
public List Returns a list of locales to be looked up for bundle loading. |
getResourceBundleProviderType | back to summary |
---|---|
public Class Returns the service provider type for the given baseName and locale, or null if no service providers should be used. |
toBundleName | back to summary |
---|---|
public String toBundleName(String baseName, Locale locale) Returns the bundle name for the given baseName and locale. |