| java.lang.Object org.zkoss.util.resource.PropertyBundle
PropertyBundle | public class PropertyBundle (Code) | | The property bundle.
It is similar to java.util.ResourceBundle, but they differ as follows.
- It uses
Maps.load(MapInputStream) to load the properties.
Thus, It is capable to handle UTF-16 and UTF-8 (but not ISO-8859-1).
- The locator could be any object as long as it implements
InputStream getResourceAsStream(String) .
- It supports only property files.
- The getBundle method returns null if the resource not found,
while ResourceBundle throws MissingResourceException.
Instances of PropertyBundle are cached, so the performance is good.
However, it implies the property file mapped by the giving
class loader, name and locale is immutable. In other words, if you
update the content of a property file, it might not be reflected to
getString unless it is cleared out of the cache.
Thread safe.
author: tomyeh |
Constructor Summary | |
protected | PropertyBundle(String baseName, Locale locale, Locator locator, boolean caseInsensitive) Constructor.
Parameters: caseInsensitive - whether the key used to access the mapis case-insensitive. |
Method Summary | |
final public static PropertyBundle | getBundle(String baseName, Locale locale, Locator locator, boolean caseInsensitive) Gets a resource bundle using the specified
base name, locale, and locator.
Parameters: locator - the locator. | final public static PropertyBundle | getBundle(String baseName, Locale locale, Locator locator) Gets a resource bundle using the specified
base name, locale, and locator. | final public static PropertyBundle | getBundle(String baseName, Locale locale, boolean caseInsensitive) Gets a resource bundle using the specified
base name, locale, and the default locator,
Locators.getDefault .
Parameters: caseInsensitive - whether the key used to access the mapis case-insensitive. | final public static PropertyBundle | getBundle(String baseName, Locale locale) Gets a resource bundle using the specified
base name, locale, and the default locator,
Locators.getDefault . | final public Locale | getLocale() Returns the locale of the bundle. | final public Map | getProperties() Returns a map of all properties, (String key , String value). | final public String | getProperty(String key) Returns the property for the given key from this resource bundle
or one of its parents. |
PropertyBundle | protected PropertyBundle(String baseName, Locale locale, Locator locator, boolean caseInsensitive)(Code) | | Constructor.
Parameters: caseInsensitive - whether the key used to access the mapis case-insensitive. If true, all keys are converted to lower cases. |
getBundle | final public static PropertyBundle getBundle(String baseName, Locale locale, Locator locator, boolean caseInsensitive)(Code) | | Gets a resource bundle using the specified
base name, locale, and locator.
Parameters: locator - the locator. Locators.getDefault. Parameters: caseInsensitive - whether the key used to access the mapis case-insensitive. If true, all keys are converted to lower cases. the bundle; null if not found |
getBundle | final public static PropertyBundle getBundle(String baseName, Locale locale, boolean caseInsensitive)(Code) | | Gets a resource bundle using the specified
base name, locale, and the default locator,
Locators.getDefault .
Parameters: caseInsensitive - whether the key used to access the mapis case-insensitive. If true, all keys are converted to lower cases. the bundle; null if not found |
getLocale | final public Locale getLocale()(Code) | | Returns the locale of the bundle.
Note: it is value might not be the same as the locale being passed
to the constructor, because the contructor will do some fallback.
|
getProperties | final public Map getProperties()(Code) | | Returns a map of all properties, (String key , String value).
|
getProperty | final public String getProperty(String key)(Code) | | Returns the property for the given key from this resource bundle
or one of its parents.
|
|
|