|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.mchaplin.commons.WmindObject
net.mchaplin.commons.i18n.PropertyResourceHelper
public class PropertyResourceHelper
Helper Class for reading messages from properties file. Keeps in memory ResourceBundle instances.
Field Summary |
---|
Fields inherited from class net.mchaplin.commons.WmindObject |
---|
EX_CAUSE, EX_STACK, log, METHOD_CALL, propertyHelper, STACK_PREFIX |
Constructor Summary | |
---|---|
PropertyResourceHelper()
Constructor for use with multiple resource bundles |
|
PropertyResourceHelper(java.util.ResourceBundle resource)
Constructor for usage with a unique resource bundle |
|
PropertyResourceHelper(java.lang.String resource,
java.lang.String locale)
Constructor for usage with a unique resource bundle |
Method Summary | |
---|---|
java.lang.String |
getMessage(java.lang.String key)
To be used in unique resource bundle mode |
java.lang.String |
getMessage(java.lang.String propsFile,
java.lang.String key)
Retrieve a message in a properties file according to the given key |
java.lang.String |
getMessage(java.lang.String propsFile,
java.lang.String key,
java.lang.String locale)
Retrieve a message in a properties file according to the given key & locale |
java.util.Map<java.lang.String,java.util.ResourceBundle> |
getMessageResources()
|
void |
reset()
For container use |
static void |
writeBundleToDisk(java.lang.String fileName,
java.util.HashMap<java.lang.String,java.lang.String> values)
Write a ResourceBundle from Disk |
Methods inherited from class net.mchaplin.commons.WmindObject |
---|
printInheritance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertyResourceHelper()
public PropertyResourceHelper(java.lang.String resource, java.lang.String locale)
resource
- resource bundle namelocale
- ISO-639 locale to usepublic PropertyResourceHelper(java.util.ResourceBundle resource)
resource
- ResourceBundle instance to useMethod Detail |
---|
public java.lang.String getMessage(java.lang.String key)
getMessage
in interface PropertyResourceHelperI
key
- key to lookup value for
public java.lang.String getMessage(java.lang.String propsFile, java.lang.String key)
getMessage
in interface PropertyResourceHelperI
propsFile
- name of the property file to load message fromkey
- name of the key identifying the message
public java.lang.String getMessage(java.lang.String propsFile, java.lang.String key, java.lang.String locale)
getMessage
in interface PropertyResourceHelperI
propsFile
- name of the property file to load message fromkey
- name of the key identifying the messagelocale
- ISO-639 locale to use
public static void writeBundleToDisk(java.lang.String fileName, java.util.HashMap<java.lang.String,java.lang.String> values)
fileName
- file name of target Bundle.values
- Hashtable of key/values pair, which will be written in
key=value formatpublic java.util.Map<java.lang.String,java.util.ResourceBundle> getMessageResources()
getMessageResources
in interface PropertyResourceHelperI
public void reset()
PropertyResourceHelperI
reset
in interface PropertyResourceHelperI
net.mchaplin.ioc.ComponentI#reset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |