Package com.complexible.common.base
Class FormattingResourceBundle
java.lang.Object
java.util.ResourceBundle
com.complexible.common.base.FormattingResourceBundle
Simple extension to ResourceBundle that handles message formatting via MessageFormat for values in the resource bundle.
- Since:
- 2.0
- Version:
- 2.0
- Author:
- Michael Grove
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control -
Field Summary
Fields inherited from class java.util.ResourceBundle
parent -
Constructor Summary
ConstructorsConstructorDescriptionFormattingResourceBundle(String theName) Create a new ResourceBundleFormattingResourceBundle(ResourceBundle theResourceBundle) Create a new FormattingResourceBundle -
Method Summary
Modifier and TypeMethodDescriptionReturn the string from theResourceBundle, optionally applying the provided args to the message viaString.format(java.lang.String, java.lang.Object...).getKeys()protected ObjecthandleGetObject(String key) Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, handleKeySet, keySet, setParent
-
Constructor Details
-
FormattingResourceBundle
Create a new FormattingResourceBundle- Parameters:
theResourceBundle- the actual bundle
-
FormattingResourceBundle
Create a new ResourceBundle- Parameters:
theName- the name of the bundle to load
-
-
Method Details
-
get
Return the string from theResourceBundle, optionally applying the provided args to the message viaString.format(java.lang.String, java.lang.Object...).- Parameters:
theKey- the message keytheArgs- the optiona list of args to apply to the message- Returns:
- the message or null if a value w/ the key does not exist
-
handleGetObject
- Specified by:
handleGetObjectin classResourceBundle
-
getKeys
- Specified by:
getKeysin classResourceBundle
-