APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.javadoc.internal.doclets.toolkit

public Class Resources

extends Object
Class Inheritance
Imports
java.text.MessageFormat, java.util.Locale, .MissingResourceException, .ResourceBundle, java.util.function.Function

Access to the localizable resources used by a doclet. The resources are split across two resource bundles: one that contains format-neutral strings common to all supported formats, and one that contains strings specific to the selected doclet, such as the standard HTML doclet.

Field Summary

Modifier and TypeField and Description
protected final ResourceBundle
protected final ResourceBundle
protected Function<String, String>

Constructor Summary

AccessConstructor and Description
public
Resources(Locale
the locale to be used when accessing the resource bundles.
locale
,
String
the name of the bundle containing the strings common to all output formats
commonBundleName
,
String
the name of the bundle containing the strings specific to a particular format
docletBundleName
)

Creates a Resources object to provide access the resource bundles used by a doclet.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the string for the given key
getText
(String
the key for the desired string
key
)

Returns the string for the given key from one of the doclet's resource bundles.

public String

Returns:

the string for the given key
getText
(String
the key for the desired string
key
,
Object...
values to be substituted into the resulting string
args
)

Returns the string for the given key (after applying the current mapper if it is not null) from one of the doclet's resource bundles, substituting additional arguments into into the resulting string with MessageFormat#format.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

commonBundleback to summary
protected final ResourceBundle commonBundle
docletBundleback to summary
protected final ResourceBundle docletBundle
mapperback to summary
protected Function<String, String> mapper

Constructor Detail

Resourcesback to summary
public Resources(Locale locale, String commonBundleName, String docletBundleName)

Creates a Resources object to provide access the resource bundles used by a doclet.

Parameters
locale:Locale

the locale to be used when accessing the resource bundles.

commonBundleName:String

the name of the bundle containing the strings common to all output formats

docletBundleName:String

the name of the bundle containing the strings specific to a particular format

Method Detail

getTextback to summary
public String getText(String key) throws MissingResourceException

Returns the string for the given key from one of the doclet's resource bundles. If the current mapper is not null, it will be applied to the key before looking up the resulting key in the resource bundle(s). The more specific bundle is checked first; if it is not there, the common bundle is then checked.

Parameters
key:String

the key for the desired string

Returns:String

the string for the given key

Exceptions
MissingResourceException:
if the key is not found in either bundle.
getTextback to summary
public String getText(String key, Object... args) throws MissingResourceException

Returns the string for the given key (after applying the current mapper if it is not null) from one of the doclet's resource bundles, substituting additional arguments into into the resulting string with MessageFormat#format. The more specific bundle is checked first; if it is not there, the common bundle is then checked.

Parameters
key:String

the key for the desired string

args:Object[]

values to be substituted into the resulting string

Returns:String

the string for the given key

Exceptions
MissingResourceException:
if the key is not found in either bundle.
setKeyMapperback to summary
public void setKeyMapper(Function<String, String> mapper)