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.ResourceBundle
Simple extension to
ResourceBundle
that handles message formatting viaMessageFormat
for 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.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...)
.java.util.Enumeration<java.lang.String>
getKeys()
protected java.lang.Object
handleGetObject(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:
handleGetObject
in classjava.util.ResourceBundle
-
getKeys
public java.util.Enumeration<java.lang.String> getKeys()
- Specified by:
getKeys
in classjava.util.ResourceBundle
-
-