Package com.complexible.common.base
Class FormattingResourceBundle
- java.lang.Object
-
- java.util.ResourceBundle
-
- com.complexible.common.base.FormattingResourceBundle
-
public final class FormattingResourceBundle extends java.util.ResourceBundleSimple extension to
ResourceBundlethat handles message formatting viaMessageFormatfor values in the resource bundle.- Since:
- 2.0
- Version:
- 2.0
- Author:
- Michael Grove
-
-
Constructor Summary
Constructors Constructor Description FormattingResourceBundle(java.lang.String theName)Create a new ResourceBundleFormattingResourceBundle(java.util.ResourceBundle theResourceBundle)Create a new FormattingResourceBundle
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringget(java.lang.String theKey, java.lang.Object... theArgs)Return the string from theResourceBundle, optionally applying the provided args to the message viaString.format(java.lang.String, java.lang.Object...).java.util.Enumeration<java.lang.String>getKeys()protected java.lang.ObjecthandleGetObject(java.lang.String key)
-
-
-
Constructor Detail
-
FormattingResourceBundle
public FormattingResourceBundle(java.util.ResourceBundle theResourceBundle)
Create a new FormattingResourceBundle- Parameters:
theResourceBundle- the actual bundle
-
FormattingResourceBundle
public FormattingResourceBundle(java.lang.String theName)
Create a new ResourceBundle- Parameters:
theName- the name of the bundle to load
-
-
Method Detail
-
get
public java.lang.String get(java.lang.String theKey, java.lang.Object... theArgs)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
protected java.lang.Object handleGetObject(java.lang.String key)
- Specified by:
handleGetObjectin classjava.util.ResourceBundle
-
getKeys
public java.util.Enumeration<java.lang.String> getKeys()
- Specified by:
getKeysin classjava.util.ResourceBundle
-
-