Top Description Fields Constructors Methods
tech.units.indriya.internal.format.l10n

public Class MultiPropertyResourceBundle

extends ResourceBundle
Class Inheritance
Imports
java.io.IOException, .InputStream, java.util.Enumeration, .HashMap, .Map, .Objects, .PropertyResourceBundle, .ResourceBundle, .Set, .Vector

Extends ResourceBundle with 2 new capabilities. The first is to store the path where the properties file used to create the InputStream is located and the second is to allow additional ResourceBundle properties to be merged into an instance.

To allow a SystemOfUnits to locate and merge extension module properties files.
Author
Werner Keil
Version
1.2

Field Summary

Modifier and TypeField and Description
private final StringBuilder
mergedBundlePaths

A StringBuilder instance containing all the paths of the ResourceBundle instances that have been merged into this instance.

private String
resourcePath

The location of the properties file that was used to instantiate the MultiPropertyResourceBundle instance.

private final Map<String, Object>
resources

A Map containing all the properties that have been merged from multiple ResourceBundle instances.

Inherited from java.util.ResourceBundle:
parent

Constructor Summary

AccessConstructor and Description
public
MultiPropertyResourceBundle(InputStream
The InputStream passed on to the super class constructor.
stream
,
String
The location of the properties file used to create the InputStream
resourcePath
)

Instantiates a new MultiPropertyResourceBundle.

public
MultiPropertyResourceBundle(ResourceBundle baseBundle, String resourcePath)

Constructor for instantiating from an existing ResourceBundle.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the key is present and false otherwise.
containsKey
(String
the resource key
key
)

Overrides java.util.ResourceBundle.containsKey.

Overrides the super class implementation to check the existence of a key across all merged bundles

public Enumeration<String>

Returns:

An Enumeration of the keys across all the merged bundles.
getKeys
()

Implements abstract java.util.ResourceBundle.getKeys.

Overrides the super class implementation to return an enumeration of keys from all the merged bundles

public StringBuilder

Returns:

Returns the StringBuilder instance containing the paths of all the ResourceBundle instances that have been merged into this instance.
getMergedBundlePaths
()

public String

Returns:

The location of the properties file that was used to instantiate the MultiPropertyResourceBundle instance.
getResourcePath
()

public Object

Returns:

An Object from the merged bundles
handleGetObject
(String
the key for the desired object
key
)

Implements abstract java.util.ResourceBundle.handleGetObject.

Overrides the super class implementation to return an object located in the merged bundles

protected Set<String>

Returns:

A Set of keys obtained from all merged bundles
handleKeySet
()

Overrides java.util.ResourceBundle.handleKeySet.

Overrides the super class implementation to return the Set of keys from all merged bundles

public Set<String>

Returns:

A Set of keys obtained from all merged bundles
keySet
()

Overrides java.util.ResourceBundle.keySet.

Overrides the super class implementation to return the Set of keys from all merged bundles

public void
merge(ResourceBundle
The ResourceBundle to merge the properties of.
resourceBundle
,
String aResourcePath)

Merges the properties of a ResourceBundle into the current MultiPropertyResourceBundle instance.

Inherited from java.util.ResourceBundle:
clearCacheclearCachegetBaseBundleNamegetBundlegetBundlegetBundlegetBundlegetBundlegetBundlegetBundlegetBundlegetLocalegetObjectgetStringgetStringArraysetParent

Field Detail

mergedBundlePathsback to summary
private final StringBuilder mergedBundlePaths

A StringBuilder instance containing all the paths of the ResourceBundle instances that have been merged into this instance. This value is intended to be use to help generate a key for caching JSON formatted resource output in the AbstractWebScript class.

resourcePathback to summary
private String resourcePath

The location of the properties file that was used to instantiate the MultiPropertyResourceBundle instance. This field is set by the constructor.

resourcesback to summary
private final Map<String, Object> resources

A Map containing all the properties that have been merged from multiple ResourceBundle instances.

Constructor Detail

MultiPropertyResourceBundleback to summary
public MultiPropertyResourceBundle(InputStream stream, String resourcePath) throws IOException

Instantiates a new MultiPropertyResourceBundle.

Parameters
stream:InputStream

The InputStream passed on to the super class constructor.

resourcePath:String

The location of the properties file used to create the InputStream

MultiPropertyResourceBundleback to summary
public MultiPropertyResourceBundle(ResourceBundle baseBundle, String resourcePath)

Constructor for instantiating from an existing ResourceBundle. This calls the merge method to copy the properties from the bundle into the resources map.

Method Detail

containsKeyback to summary
public boolean containsKey(String key)

Overrides java.util.ResourceBundle.containsKey.

Overrides the super class implementation to check the existence of a key across all merged bundles

Parameters
key:String

Doc from java.util.ResourceBundle.containsKey.

the resource key

Returns:boolean

true if the key is present and false otherwise.

Annotations
@Override
getKeysback to summary
public Enumeration<String> getKeys()

Implements abstract java.util.ResourceBundle.getKeys.

Overrides the super class implementation to return an enumeration of keys from all the merged bundles

Returns:Enumeration<String>

An Enumeration of the keys across all the merged bundles.

Annotations
@Override
getMergedBundlePathsback to summary
public StringBuilder getMergedBundlePaths()
Returns:StringBuilder

Returns the StringBuilder instance containing the paths of all the ResourceBundle instances that have been merged into this instance.

getResourcePathback to summary
public String getResourcePath()
Returns:String

The location of the properties file that was used to instantiate the MultiPropertyResourceBundle instance.

handleGetObjectback to summary
public Object handleGetObject(String key)

Implements abstract java.util.ResourceBundle.handleGetObject.

Overrides the super class implementation to return an object located in the merged bundles

Parameters
key:String

Doc from java.util.ResourceBundle.handleGetObject.

the key for the desired object

Returns:Object

An Object from the merged bundles

Annotations
@Override
handleKeySetback to summary
protected Set<String> handleKeySet()

Overrides java.util.ResourceBundle.handleKeySet.

Overrides the super class implementation to return the Set of keys from all merged bundles

Returns:Set<String>

A Set of keys obtained from all merged bundles

Annotations
@Override
keySetback to summary
public Set<String> keySet()

Overrides java.util.ResourceBundle.keySet.

Overrides the super class implementation to return the Set of keys from all merged bundles

Returns:Set<String>

A Set of keys obtained from all merged bundles

Annotations
@Override
mergeback to summary
public void merge(ResourceBundle resourceBundle, String aResourcePath)

Merges the properties of a ResourceBundle into the current MultiPropertyResourceBundle instance. This will override any values mapped to duplicate keys in the current merged properties.

Parameters
resourceBundle:ResourceBundle

The ResourceBundle to merge the properties of.