Name

ListResourceBundle

Synopsis

This abstract class provides a simple way to define a ResourceBundle. You may find it easier to subclass ListResourceBundle than to subclass ResourceBundle directly. ListResourceBundle provides implementations for the abstract handleGetObject( ) and getKeys( ) methods defined by ResourceBundle and adds its own abstract getContents( ) method a subclass must override. getContents( ) returns an Object[ ][ ]—an array of arrays of objects. This array can have any number of elements. Each element of this array must itself be an array with two elements: the first element of each subarray should be a String that specifies the name of a resource, and the corresponding second element should be the value of that resource; this value can be an Object of any desired type. See also ResourceBundle and PropertyResourceBundle.

java.util.ListResourceBundle

Figure 16-41. java.util.ListResourceBundle

public abstract class ListResourceBundle extends ResourceBundle {
// Public Constructors
     public ListResourceBundle( );  
// Public Methods Overriding ResourceBundle
     public Enumeration<String> getKeys( );  
     public final Object handleGetObject(String key);  
// Protected Instance Methods
     protected abstract Object[ ][ ] getContents( );  
}

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.