📜  Java.util.ResourceBundle.Control类

📅  最后修改于: 2020-11-14 06:22:49             🧑  作者: Mango


介绍

java.util.ResourceBundle.Control类与工厂方法协作以加载资源束。以下是ResourceBundle.Control的重点-

  • 如果多个线程同时使用该类实例,则该实例必须是线程安全的。

类声明

以下是java.util.ResourceBundle.Control类的声明-

public static class ResourceBundle.Control
   extends Object

领域

以下是java.util.ResourceBundle.Control类的字段-

  • static int STANDARD_TIME-这是指定为标准时间的开始或结束时间模式的常数。

  • 静态List FORMAT_CLASS-这是包含“ java.class”的格式列表。

  • 静态List FORMAT_DEFAULT-这是默认格式List,按顺序包含字符串“ java.class”和“ java.properties”。

  • 静态List FORMAT_PROPERTIES-这是仅属性格式的列表,其中包含“ java.properties”。

  • 静态长TTL_DONT_CACHE-这是不缓存加载的资源包实例的生存时间常数。

  • 静态长TTL_NO_EXPIRATION_CONTROL-这是生存时间常数,用于为缓存中已加载的资源包实例禁用过期控制。

类的构造函数

Sr.No. Constructor & Description
1

List getCandidateLocales(String baseName, Locale locale)

This is the single constructor.

类方法

Sr.No. Method & Description
1 ListgetCandidateLocales(String baseName, Locale locale)

This method returns a List of Locales as candidate locales for baseName and locale.

2 static ResourceBundle.Control getControl(List formats)

This method returns a ResourceBundle.Control in which the getFormats method returns the specified formats.

3 Locale getFallbackLocale(String baseName, Locale locale)

This method returns a Locale to be used as a fallback locale for further resource bundle searches by the ResourceBundle.getBundle factory method.

4 List getFormats(String baseName)

This method returns a list of strings containing formats to be used to load resource bundles for the given baseName.

5 static ResourceBundle.Control getNoFallbackControl(List formats)

This method returns a ResourceBundle.Control in which the getFormats method returns the specified formats and the getFallbackLocale method returns null.

6 long getTimeToLive(String baseName, Locale locale)

This method returns the time-to-live (TTL) value for resource bundles that are loaded under this ResourceBundle.Control.

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

This method determines if the expired bundle in the cache needs to be reloaded based on the loading time given by loadTime or some other criteria.

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

This method instantiates a resource bundle for the given bundle name of the given format and locale, using the given class loader if necessary.

9 String toBundleName(String baseName, Locale locale)

This method converts the given baseName and locale to the bundle name.

10 String toResourceName(String bundleName, String suffix)

This method converts the given bundleName to the form required by the ClassLoader.getResource method by replacing all occurrences of ‘.’ in bundleName with ‘/’ and appending a ‘.’ and the given file suffix.

方法继承

此类从以下类继承方法-

  • java.util.Object