public static class ResourceBundle.Control extends Object
Modifier and Type | Field and Description |
---|---|
static List<String> |
FORMAT_CLASS
a list defines java class format
|
static List<String> |
FORMAT_DEFAULT
a list defines default format
|
static List<String> |
FORMAT_PROPERTIES
a list defines property format
|
static long |
TTL_DONT_CACHE
a constant that indicates cache will not be used.
|
static long |
TTL_NO_EXPIRATION_CONTROL
a constant that indicates cache will not be expired.
|
Modifier | Constructor and Description |
---|---|
protected |
ResourceBundle.Control()
default constructor
|
Modifier and Type | Method and Description |
---|---|
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
|
String |
toResourceName(String bundleName,
String suffix)
a utility method to answer the name of a resource according to the
given bundleName and suffix
|
public static final long TTL_DONT_CACHE
public static final long TTL_NO_EXPIRATION_CONTROL
public static ResourceBundle.Control getControl(List<String> formats)
formats
.public static ResourceBundle.Control getNoFallbackControl(List<String> formats)
formats
whose fallback
locale is null.public List<Locale> getCandidateLocales(String baseName, Locale locale)
baseName
in
locale
.public List<String> getFormats(String baseName)
baseName
.public Locale getFallbackLocale(String baseName, Locale locale)
baseName
in locale
.public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException
baseName
- the base name to uselocale
- the given localeformat
- the format, default is "java.class" or "java.properties"loader
- the classloader to usereload
- whether to reload the resourceIllegalAccessException
- if we can not access resourcesInstantiationException
- if we can not instantiate a resource classIOException
- if other I/O exception happenspublic long getTimeToLive(String baseName, Locale locale)
baseName
in locale
,
default is TTL_NO_EXPIRATION_CONTROL.public boolean needsReload(String baseName, Locale locale, String format, ClassLoader loader, ResourceBundle bundle, long loadTime)
baseName
- the base name of the ResourceBundlelocale
- the locale of the ResourceBundleformat
- the format to loadloader
- the ClassLoader to load resourcebundle
- the ResourceBundleloadTime
- the expired timepublic String toBundleName(String baseName, Locale locale)
baseName
- the given base namelocale
- the locale to usepublic final String toResourceName(String bundleName, String suffix)
bundleName
- the given bundle namesuffix
- the suffix