Android APIs
public static class

ResourceBundle.Control

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

Class Overview

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
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final long TTL_DONT_CACHE

Added in API level 9

a constant that indicates cache will not be used.

Constant Value: -1 (0xffffffffffffffff)

public static final long TTL_NO_EXPIRATION_CONTROL

Added in API level 9

a constant that indicates cache will not be expired.

Constant Value: -2 (0xfffffffffffffffe)

Fields

public static final List<String> FORMAT_CLASS

Added in API level 9

a list defines java class format

public static final List<String> FORMAT_DEFAULT

Added in API level 9

a list defines default format

public static final List<String> FORMAT_PROPERTIES

Added in API level 9

a list defines property format

Protected Constructors

protected ResourceBundle.Control ()

Added in API level 9

default constructor

Public Methods

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

Added in API level 9

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

Parameters
baseName
locale
Returns
List<Locale>

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

Added in API level 9

Returns a control according to formats.

Parameters
formats
Returns
ResourceBundle.Control

public Locale getFallbackLocale (String baseName, Locale locale)

Added in API level 9

Returns the fallback locale for baseName in locale.

Parameters
baseName
locale
Returns
Locale

public List<String> getFormats (String baseName)

Added in API level 9

Returns a list of strings of formats according to baseName.

Parameters
baseName
Returns
List<String>

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

Added in API level 9

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

Parameters
formats
Returns
ResourceBundle.Control

public long getTimeToLive (String baseName, Locale locale)

Added in API level 9

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

Parameters
baseName
locale
Returns
long

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

Added in API level 9

Returns true if the ResourceBundle needs to reload.

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

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

Added in API level 9

Returns a new ResourceBundle.

Parameters
baseName the base name to use
locale the given locale
format the format, default is "java.class" or "java.properties"
loader the classloader to use
reload 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

public String toBundleName (String baseName, Locale locale)

Added in API level 9

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

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

public final String toResourceName (String bundleName, String suffix)

Added in API level 9

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

Parameters
bundleName the given bundle name
suffix the suffix
Returns
String the name of a resource according to the given bundleName and suffix