A read-only encapsulation of one or more ResourceBundles that adds automatic string conversion, support for field and Swing component property injection, string resource variable substitution, and chaining.
ResourceMaps are typically obtained with the {@code ApplicationContext} {@link ApplicationContext#getResourceMap getResourceMap} methodwhich lazily creates per Application, package, and class ResourceMaps that are linked together with the ResourceMap parent property.
An individual ResourceMap provides read-only access to all of the resources defined by the ResourceBundles named when the ResourceMap was created as well as all of its parent ResourceMaps. Resources are retrieved with the getObject method which requires both the name of the resource and its expected type. The latter is used to convert strings if neccessary. Converted values are cached. As a convenience, getObject wrapper methods for common GUI types, like getFont, and getColor, are provided.
The getObject method scans raw string resource values for ${resourceName} variable substitutions before performing string conversion. Variables named this way can refer to String resources defined anywhere in their ResourceMap or any parent ResourceMap. The special variable ${null} means that the value of the resource will be null.
ResourceMaps can be used to "inject" resource values into Swing component properties and into object fields. The injectComponents method uses Component names ( {@link Component#setName}) to match resources names with properties. The injectFields method sets fields that have been tagged with the @Resource annotation to the value of resources with the same name.
@author Hans Muller (Hans.Muller@Sun.COM)
@see #injectComponents
@see #injectFields
@see ResourceConverter
@see ResourceBundle