- java.lang.Object
 -  
      
- java.util.ResourceBundle
 -  
        
- java.util.ListResourceBundle
 
 
 
-  
       
- 已知直接子类:
 -  
         
AccessibleResourceBundle 
public abstract class ListResourceBundle extends ResourceBundle
ListResourceBundle是一个抽象类ResourceBundle管理资源,以方便和易于使用的列表区域设置。 有关资源包的更多信息,请参见ResourceBundle。子类必须覆盖
getContents并提供一个数组,其中数组中的每个项目都是一对对象。 每对的第一个元素是键,它必须是String,第二个元素是与该键相关联的值。以下example显示了资源包系列的两个成员,其基本名称为“MyResources”。 “MyResources”是捆绑系列的默认成员,“MyResources_fr”是法国成员。 这些成员基于
ListResourceBundle(相关的example显示了如何将捆绑包添加到基于属性文件的此系列)。 此示例中的键的形式为“s1”等。实际的键完全取决于您的选择,只要它们与您在程序中用于从包中检索对象的键相同即可。 键区分大小写。public class MyResources extends ListResourceBundle { protected Object[][] getContents() { return new Object[][] { // LOCALIZE THIS {"s1", "The disk \"{1}\" contains {0}."}, // MessageFormat pattern {"s2", "1"}, // location of {0} in pattern {"s3", "My Disk"}, // sample disk name {"s4", "no files"}, // first ChoiceFormat choice {"s5", "one file"}, // second ChoiceFormat choice {"s6", "{0,number} files"}, // third ChoiceFormat choice {"s7", "3 Mar 96"}, // sample date {"s8", new Dimension(1,5)} // real object, not just string // END OF MATERIAL TO LOCALIZE }; } } public class MyResources_fr extends ListResourceBundle { protected Object[][] getContents() { return new Object[][] { // LOCALIZE THIS {"s1", "Le disque \"{1}\" {0}."}, // MessageFormat pattern {"s2", "1"}, // location of {0} in pattern {"s3", "Mon disque"}, // sample disk name {"s4", "ne contient pas de fichiers"}, // first ChoiceFormat choice {"s5", "contient un fichier"}, // second ChoiceFormat choice {"s6", "contient {0,number} fichiers"}, // third ChoiceFormat choice {"s7", "3 mars 1996"}, // sample date {"s8", new Dimension(1,3)} // real object, not just string // END OF MATERIAL TO LOCALIZE }; } }如果
ListResourceBundle子类同时由多个线程使用,则它的实现必须是线程安全的。 此类中方法的默认实现是线程安全的。- 从以下版本开始:
 - 1.1
 - 另请参见:
 -  
         
ResourceBundle,PropertyResourceBundle 
 
-  
        
       
-  
             
嵌套类汇总
-  
               
嵌套类/接口声明在类 java.util.ResourceBundle
ResourceBundle.Control 
 -  
               
 
-  
             
字段汇总
-  
               
声明的属性在类 java.util.ResourceBundle
parent 
 -  
               
 
-  
             
构造方法摘要
构造方法 构造器 描述 ListResourceBundle()唯一的构造函数。 
-  
             
方法摘要
所有方法 实例方法 抽象方法 具体的方法 变量和类型 方法 描述 protected abstract Object[][]getContents()返回一个数组,其中每个项目是Object数组中的一对对象。Enumeration<String>getKeys()返回一个Enumeration包含在此按键ResourceBundle及其父包。protected Set<String>handleKeySet()返回Set只有在这个包含的键ResourceBundle。-  
               
声明方法的类 java.util.ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, handleGetObject, keySet, setParent 
 -  
               
 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
getKeys
public Enumeration<String> getKeys()
返回一个Enumeration包含在此按键ResourceBundle及其父包。- Specified by:
 -  
              
getKeys在类ResourceBundle - 结果
 - 
               一个 
              
Enumeration包含在该键的ResourceBundle及其父包。 - 另请参见:
 -  
              
ResourceBundle.keySet() 
 
-  
handleKeySet
protected Set<String> handleKeySet()
返回Set只有在这个包含的键ResourceBundle。- 重写:
 -  
              
handleKeySet在类ResourceBundle - 结果
 -  
              
Set这些密钥仅包含在ResourceBundle - 从以下版本开始:
 - 1.6
 - 另请参见:
 -  
              
ResourceBundle.keySet() 
 
-  
getContents
protected abstract Object[][] getContents()
返回一个数组,其中每个项目是Object数组中的一对对象。 每对的第一个元素是键,它必须是String,第二个元素是与该键相关联的值。 有关详细信息,请参阅类说明。- 结果
 - 
               表示键值对的 
              
Object数组的数组。 
 
 -  
 
 -