Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 748
نمايش فراداده

ResourceBundlejava.util

Java 1.1

This abstract class allows subclasses to define sets of localized resources that can then be dynamically loaded as needed by internationalized programs. Such resources may include user-visible text and images that appear in an application, as well as more complex things such as Menu objects. Use getBundle( ) to load a ResourceBundle subclass that is appropriate for the default or specified locale. Use getObject( ), getString( ), and getStringArray( ) to look up a named resource in a bundle. To define a bundle, provide implementations of handleGetObject( ) and getKeys( ). It is often easier, however, to subclass ListResourceBundle or provide a Properties file that is used by PropertyResourceBundle. The name of any localized ResourceBundle class you define should include the locale language code, and, optionally, the locale country code.

public abstract class

ResourceBundle { // Public Constructors public

ResourceBundle ( ); // Public Class Methods public static final ResourceBundle

getBundle (String

baseName ); public static final ResourceBundle

getBundle (String

baseName , Locale

locale );

1.2 public static ResourceBundle

getBundle (String

baseName , Locale

locale , ClassLoader

loader ); // Public Instance Methods public abstract Enumeration<String>

getKeys ( );

1.2 public Locale

getLocale ( ); public final Object

getObject (String

key ); public final String

getString (String

key ); public final String[ ]

getStringArray (String

key ); // Protected Instance Methods protected abstract Object

handleGetObject (String

key ); protected void

setParent (ResourceBundle

parent ); // Protected Instance Fields protected ResourceBundle

parent ; }

Subclasses

ListResourceBundle, PropertyResourceBundle

Passed To

java.util.logging.LogRecord.setResourceBundle( )

Returned By

java.util.logging.Logger.getResourceBundle( ), java.util.logging.LogRecord.getResourceBundle( )