Skip to content

Most visited

Recently visited

navigation
Added in API level 9

ResourceBundle.Control

public static class ResourceBundle.Control
extends Object

java.lang.Object
   ↳ java.util.ResourceBundle.Control


ResourceBundle.Control is a static utility class defines ResourceBundle load access methods, its default access order is as the same as before. However users can implement their own control.

Summary

Constants

long TTL_DONT_CACHE

a constant that indicates cache will not be used.

long TTL_NO_EXPIRATION_CONTROL

a constant that indicates cache will not be expired.

Fields

public static final List<String> FORMAT_CLASS

a list defines java class format

public static final List<String> FORMAT_DEFAULT

a list defines default format

public static final List<String> FORMAT_PROPERTIES

a list defines property format

Protected constructors

ResourceBundle.Control()

default constructor

Public methods

List<Locale> getCandidateLocales(String baseName, Locale locale)

Returns a list of candidate locales according to baseName in locale.

static ResourceBundle.Control getControl(List<String> formats)

Returns a control according to formats.

Locale getFallbackLocale(String baseName, Locale locale)

Returns the fallback locale for baseName in locale.

List<String> getFormats(String baseName)

Returns a list of strings of formats according to baseName.

static ResourceBundle.Control getNoFallbackControl(List<String> formats)

Returns a control according to formats whose fallback locale is null.

long getTimeToLive(String baseName, Locale locale)

Returns the time to live of the ResourceBundle baseName in locale, default is TTL_NO_EXPIRATION_CONTROL.

boolean needsReload(String baseName, Locale locale, String format, ClassLoader loader, ResourceBundle bundle, long loadTime)

Returns true if the ResourceBundle needs to reload.

ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)

Returns a new ResourceBundle.

String toBundleName(String baseName, Locale locale)

a utility method to answer the name of a resource bundle according to the given base name and locale

final String toResourceName(String bundleName, String suffix)

a utility method to answer the name of a resource according to the given bundleName and suffix

Inherited methods

From class java.lang.Object

Constants

TTL_DONT_CACHE

Added in API level 9
long TTL_DONT_CACHE

a constant that indicates cache will not be used.

Constant Value: -1 (0xffffffffffffffff)

TTL_NO_EXPIRATION_CONTROL

Added in API level 9
long TTL_NO_EXPIRATION_CONTROL

a constant that indicates cache will not be expired.

Constant Value: -2 (0xfffffffffffffffe)

Fields

FORMAT_CLASS

Added in API level 9
List<String> FORMAT_CLASS

a list defines java class format

FORMAT_DEFAULT

Added in API level 9
List<String> FORMAT_DEFAULT

a list defines default format

FORMAT_PROPERTIES

Added in API level 9
List<String> FORMAT_PROPERTIES

a list defines property format

Protected constructors

ResourceBundle.Control

Added in API level 9
ResourceBundle.Control ()

default constructor

Public methods

getCandidateLocales

Added in API level 9
List<Locale> getCandidateLocales (String baseName, 
                Locale locale)

Returns a list of candidate locales according to baseName in locale.

Parameters
baseName String
locale Locale
Returns
List<Locale>

getControl

Added in API level 9
ResourceBundle.Control getControl (List<String> formats)

Returns a control according to formats.

Parameters
formats List
Returns
ResourceBundle.Control

getFallbackLocale

Added in API level 9
Locale getFallbackLocale (String baseName, 
                Locale locale)

Returns the fallback locale for baseName in locale.

Parameters
baseName String
locale Locale
Returns
Locale

getFormats

Added in API level 9
List<String> getFormats (String baseName)

Returns a list of strings of formats according to baseName.

Parameters
baseName String
Returns
List<String>

getNoFallbackControl

Added in API level 9
ResourceBundle.Control getNoFallbackControl (List<String> formats)

Returns a control according to formats whose fallback locale is null.

Parameters
formats List
Returns
ResourceBundle.Control

getTimeToLive

Added in API level 9
long getTimeToLive (String baseName, 
                Locale locale)

Returns the time to live of the ResourceBundle baseName in locale, default is TTL_NO_EXPIRATION_CONTROL.

Parameters
baseName String
locale Locale
Returns
long

needsReload

Added in API level 9
boolean needsReload (String baseName, 
                Locale locale, 
                String format, 
                ClassLoader loader, 
                ResourceBundle bundle, 
                long loadTime)

Returns true if the ResourceBundle needs to reload.

Parameters
baseName String: the base name of the ResourceBundle
locale Locale: the locale of the ResourceBundle
format String: the format to load
loader ClassLoader: the ClassLoader to load resource
bundle ResourceBundle: the ResourceBundle
loadTime long: the expired time
Returns
boolean if the ResourceBundle needs to reload

newBundle

Added in API level 9
ResourceBundle newBundle (String baseName, 
                Locale locale, 
                String format, 
                ClassLoader loader, 
                boolean reload)

Returns a new ResourceBundle.

Parameters
baseName String: the base name to use
locale Locale: the given locale
format String: the format, default is "java.class" or "java.properties"
loader ClassLoader: the classloader to use
reload boolean: whether to reload the resource
Returns
ResourceBundle a new ResourceBundle according to the give parameters
Throws
IllegalAccessException if we can not access resources
InstantiationException if we can not instantiate a resource class
IOException if other I/O exception happens

toBundleName

Added in API level 9
String toBundleName (String baseName, 
                Locale locale)

a utility method to answer the name of a resource bundle according to the given base name and locale

Parameters
baseName String: the given base name
locale Locale: the locale to use
Returns
String the name of a resource bundle according to the given base name and locale

toResourceName

Added in API level 9
String toResourceName (String bundleName, 
                String suffix)

a utility method to answer the name of a resource according to the given bundleName and suffix

Parameters
bundleName String: the given bundle name
suffix String: the suffix
Returns
String the name of a resource according to the given bundleName and suffix
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.