Top Description Fields Constructors Methods
org.apache.commons.text.lookup

pack-priv final Class ResourceBundleStringLookup

extends AbstractStringLookup
Class Inheritance
Imports
java.util.MissingResourceException, .ResourceBundle

Looks up keys from resource bundles.

Looks up the value for a given key in the format "BundleName:BundleKey".

For example: "com.domain.messages:MyKey".

Public access is through StringLookupFactory.

Since
1.3
See Also
StringLookupFactory, ResourceBundle

Field Summary

Modifier and TypeField and Description
private final String
bundleName

The name of the resource bundle from which to look something up.

pack-priv static final ResourceBundleStringLookup
INSTANCE

Defines the singleton for this class.

Inherited from org.apache.commons.text.lookup.AbstractStringLookup:
SPLIT_CHSPLIT_STR

Constructor Summary

AccessConstructor and Description
private
ResourceBundleStringLookup()

Constructs a blank instance.

pack-priv
ResourceBundleStringLookup(final String
the name of the resource bundle from which we will look keys up.
bundleName
)

Constructs an instance that only works for the given bundle.

Method Summary

Modifier and TypeMethod and Description
pack-priv ResourceBundle
getBundle(final String keyBundleName)

pack-priv String
getString(final String keyBundleName, final String bundleKey)

public String

Returns:

The value associated with the key.
lookup
(final String
the key to be looked up, may be null.
key
)

Implements org.apache.commons.text.lookup.StringLookup.lookup.

Looks up the value for the key in the format "BundleName:BundleKey".

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.apache.commons.text.lookup.AbstractStringLookup:
substringAftersubstringAftersubstringAfterLasttoLookupKeytoLookupKey

Field Detail

bundleNameback to summary
private final String bundleName

The name of the resource bundle from which to look something up.

INSTANCEback to summary
pack-priv static final ResourceBundleStringLookup INSTANCE

Defines the singleton for this class.

Constructor Detail

ResourceBundleStringLookupback to summary
private ResourceBundleStringLookup()

Constructs a blank instance.

ResourceBundleStringLookupback to summary
pack-priv ResourceBundleStringLookup(final String bundleName)

Constructs an instance that only works for the given bundle.

Parameters
bundleName:String

the name of the resource bundle from which we will look keys up.

Since
1.5

Method Detail

getBundleback to summary
pack-priv ResourceBundle getBundle(final String keyBundleName)
getStringback to summary
pack-priv String getString(final String keyBundleName, final String bundleKey)
lookupback to summary
public String lookup(final String key)

Implements org.apache.commons.text.lookup.StringLookup.lookup.

Looks up the value for the key in the format "BundleName:BundleKey". For example: "com.domain.messages:MyKey".

Parameters
key:String

the key to be looked up, may be null.

Returns:String

The value associated with the key.

Annotations
@Override
See Also
ResourceBundle, ResourceBundle#getBundle(String), ResourceBundle#getString(String)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override