Resource Bundles Flashcards

1
Q

Returns the value mapped to the given key. Throws a MissingResourceException if no object for a given key is found.

A

Object getObject(String key)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Returns the ResourceBundle for the given baseName, locale, and control; throws a MissingResourceException if no matching resource bundle is found. The Control instance is meant for controlling or obtaining info about the resource bundle loading process.

A

static ResourceBundle getBundle(String baseName)
static final ResourceBundle getBundle(String baseName, Locale locale)
final ResourceBundle getBundle(String baseName, Locale targetLocale, Control control)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Returns the value mapped to a given key; equivalent to casting the return value from getObject() to String. Throws a MissingResourceException if no object for a given key is found. Throws ClassCastException if the object returned is not a string.

A

String getString(String key)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

This concrete class provides support for multiple locales in the form of property files. For each locale, if you use the ResourceBundle.getBundle() method, the relevant property file will be loaded if the proper naming conventions for the property files are followed.

A

PropertyResourceBundle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

This abstract class provides support for locales within the program itself without using property files. Extend this class and override the getContents() method to return an Object array containing the locale data.

A

ListResourceBundle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Load the resource bundle.

A

ResourceBundle.getBundle(String bundleName, Locale locale)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly